Search Results

Search found 37183 results on 1488 pages for 'string conversion'.

Page 140/1488 | < Previous Page | 136 137 138 139 140 141 142 143 144 145 146 147  | Next Page >

  • Correct display of a string...

    - by Jamal Abdul Nasir
    How to display a string in correct format as i enter it in the textarea in ruby on rails? actually i enter some string in the textarea as: my name is jamal. now there is a next line starting after name... but i get the following in the view... my name is jamal which i don't want to be like that... so, how to get the correct format..? i hope u understand...

    Read the article

  • how to search some character inside string

    - by klox
    i have been type some string inside textfield that is "KD-G435MUN2D"... i already use this code for search "UD" character from that string: <script> var str="KD-R435MUN2D"; var patt1=/UD/gi; document.write(str.match(patt1)); </script> but this code doesn't work..where is my fault?

    Read the article

  • Html string reader

    - by Oakcool
    Hi all, I need to load HTML and parse it, I think that it should be something simple, I pass a string with a "HTML" it reads the string in a Dom like object, so I can search and parse the content of the HTML, facilitating scraping and things like that. Do you guys know about any thing like that. Thanks

    Read the article

  • Rewrite query string "?x=y" style to "/x/y" style

    - by Ross
    I have a PHP MVC framework I've built from scratch which uses the traditional domain.com/controller/action URL routing. While I'm currently handling the below conversion in the router I'd like to replace them in the URL for cosmetic reasons. For example: controller/action?filter=bank Becomes: controller/action/filter/bank I've done a bit of experimentation with a regex but can't seem to find a match. I'm also not sure how to rewrite it using RewriteCond. Thanks in advance.

    Read the article

  • passing unicode string from C# exe to C++ DLL

    - by Martin
    Using this function in my C# exe, I try to pass a Unicode string to my C++ DLL: [DllImport("Test.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)] public static extern int xSetTestString(StringBuilder xmlSettings); This is the function on the C++ DLL side: __declspec(dllexport) int xSetTestString(char* pSettingsXML); Before calling the function in C#, I do a MessageBox.Show(string) and it displays all characters properly. On the C++ side, I do: OutputDebugStringW((wchar_t*)pString);, but that shows that the non-ASCII characters were replaced by '?'.

    Read the article

  • Looking for a good Delphi unicode string library

    - by volvox
    Any suggestion for a good unicode string library for Delphi 2010? Such thing as class that would contain a collection of independent functions, basically an encapsulation of functions that manipulate strings (ex: Trimlike, Character removal, Positional, Sub-string, Compare, Informational, Case, Replacement, Manipulation functions etc. ). Thanks

    Read the article

  • Doctrine: String keys with Array hydration

    - by BenV
    According to their documentation, you should use Array hydration rather than record hydration when retrieving data for read-only purposes. However, this means I have to access the attributes of the retrieved object using arrays and string keys: $user['Phonenumbers'][0]['number'] instead of the OO style: $user->PhoneNumbers[0]->number Now I'm kinda new to PHP, but in other languages I've worked with the 2nd notation would be preferable because typos would be caught at compile time while typos in string literals would not be noticed until runtime. Does this apply to PHP/Doctrine?

    Read the article

  • Receiving a JSON string & saving one of the array paramaters to the database as a full string

    - by ElTren
    Hi I have a JSON string that looks like this (Usingt Rails and a REST service) { person: { name:"Pepe", last:"Smith" hats:[ { team:"lakers", color:"purple"}, { team:"heats", color:"red" }] } } I want to be able to able to get that JSON, and save the Person to the database, but I want to save the "hats".. as a string to the database; without parsing it or anything like that i.e. I want to save this to SQL: hats = "[ { team:"lakers", color:"purple"}, { team:"heats", color:"red" }] }" Is there a way to do this in rails?

    Read the article

  • how to pass an id number string to this class (asp.net, c#)

    - by Phil
    I'm very much a vb person, but have had to use this id number class in c#. I got it from http://www.codingsanity.com/idnumber.htm : using System; using System.Text.RegularExpressions; namespace Utilities.SouthAfrica { /// <summary> /// Represents a South African Identity Number. /// valid number = 7707215230080 /// invalid test number = 1234567891234 /// /// </summary> [Serializable()] public class IdentityNumber { #region Enumerations /// <summary> /// Indicates a gender. /// </summary> public enum PersonGender { Female = 0, Male = 5 } public enum PersonCitizenship { SouthAfrican = 0, Foreign = 1 } #endregion #region Declarations static Regex _expression; Match _match; const string _IDExpression = @"(?<Year>[0-9][0-9])(?<Month>([0][1-9])|([1][0-2]))(?<Day>([0-2][0-9])|([3][0-1]))(?<Gender>[0-9])(?<Series>[0-9]{3})(?<Citizenship>[0-9])(?<Uniform>[0-9])(?<Control>[0-9])"; #endregion #region Constuctors /// <summary> /// Sets up the shared objects for ID validation. /// </summary> static IdentityNumber() { _expression = new Regex(_IDExpression, RegexOptions.Compiled | RegexOptions.Singleline); } /// <summary> /// Creates the ID number from a string. /// </summary> /// <param name="IDNumber">The string ID number.</param> public IdentityNumber(string IDNumber) { _match = _expression.Match(IDNumber.Trim()); } #endregion #region Properties /// <summary> /// Indicates the date of birth encoded in the ID Number. /// </summary> /// <exception cref="System.ArgumentException">Thrown if the ID Number is not usable.</exception> public DateTime DateOfBirth { get { if(IsUsable == false) { throw new ArgumentException("ID Number is unusable!", "IDNumber"); } int year = int.Parse(_match.Groups["Year"].Value); // NOTE: Do not optimize by moving these to static, otherwise the calculation may be incorrect // over year changes, especially century changes. int currentCentury = int.Parse(DateTime.Now.Year.ToString().Substring(0, 2) + "00"); int lastCentury = currentCentury - 100; int currentYear = int.Parse(DateTime.Now.Year.ToString().Substring(2, 2)); // If the year is after or at the current YY, then add last century to it, otherwise add // this century. // TODO: YY -> YYYY logic needs thinking about if(year > currentYear) { year += lastCentury; } else { year += currentCentury; } return new DateTime(year, int.Parse(_match.Groups["Month"].Value), int.Parse(_match.Groups["Day"].Value)); } } /// <summary> /// Indicates the gender for the ID number. /// </summary> /// <exception cref="System.ArgumentException">Thrown if the ID Number is not usable.</exception> public PersonGender Gender { get { if(IsUsable == false) { throw new ArgumentException("ID Number is unusable!", "IDNumber"); } int gender = int.Parse(_match.Groups["Gender"].Value); if(gender < (int) PersonGender.Male) { return PersonGender.Female; } else { return PersonGender.Male; } } } /// <summary> /// Indicates the citizenship for the ID number. /// </summary> /// <exception cref="System.ArgumentException">Thrown if the ID Number is not usable.</exception> public PersonCitizenship Citizenship { get { if(IsUsable == false) { throw new ArgumentException("ID Number is unusable!", "IDNumber"); } return (PersonCitizenship) Enum.Parse(typeof(PersonCitizenship), _match.Groups["Citizenship"].Value); } } /// <summary> /// Indicates if the IDNumber is usable or not. /// </summary> public bool IsUsable { get { return _match.Success; } } /// <summary> /// Indicates if the IDNumber is valid or not. /// </summary> public bool IsValid { get { if(IsUsable == true) { // Calculate total A by adding the figures in the odd positions i.e. the first, third, fifth, // seventh, ninth and eleventh digits. int a = int.Parse(_match.Value.Substring(0, 1)) + int.Parse(_match.Value.Substring(2, 1)) + int.Parse(_match.Value.Substring(4, 1)) + int.Parse(_match.Value.Substring(6, 1)) + int.Parse(_match.Value.Substring(8, 1)) + int.Parse(_match.Value.Substring(10, 1)); // Calculate total B by taking the even figures of the number as a whole number, and then // multiplying that number by 2, and then add the individual figures together. int b = int.Parse(_match.Value.Substring(1, 1) + _match.Value.Substring(3, 1) + _match.Value.Substring(5, 1) + _match.Value.Substring(7, 1) + _match.Value.Substring(9, 1) + _match.Value.Substring(11, 1)); b *= 2; string bString = b.ToString(); b = 0; for(int index = 0; index < bString.Length; index++) { b += int.Parse(bString.Substring(index, 1)); } // Calculate total C by adding total A to total B. int c = a + b; // The control-figure can now be determined by subtracting the ones in figure C from 10. string cString = c.ToString() ; cString = cString.Substring(cString.Length - 1, 1) ; int control = 0; // Where the total C is a multiple of 10, the control figure will be 0. if(cString != "0") { control = 10 - int.Parse(cString.Substring(cString.Length - 1, 1)); } if(_match.Groups["Control"].Value == control.ToString()) { return true; } } return false; } } #endregion } } Can someone please tell the syntax for how I pass an id number to the class? Thanks

    Read the article

  • what is wrong with connection string

    - by Hakan
    Can any one help me with this connection string. I can't manage how to fix. Dim constring As String Dim con As SqlCeConnection Dim cmd As SqlCeCommand constring = "(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + \\database.sdf;Password=pswrd;File Mode=shared read" con = New SqlCeConnection() con.Open() Thanks

    Read the article

  • use split() for splitting a string

    - by Hamed
    Hi again... Guys I'd asked 2 questions before and I'd said that I want to split a string like below: Input string: a=aa|b=b||b|c=cc and the output: a=aa b=b||b c=cc some guys answer my question but they use .Match(): var matches = "a=aa|b=b||b|c=cc".match(/(?:[^|]|\|\|)+/g) but I need to use the .split() method and store the outputs in an array. please help me guys... It's so critical... Thanks...

    Read the article

  • convert string of millisecond into datetime in python

    - by newbie
    I am a newbie in Python. I want to substract interval time from my log file, but the problem is I cannot convert millisecond string of log file into datetime format. For example, I have 15:55:05.12345 and I want to remove 5.12345 seconds from this string, and shwow result of 15.55.00.00000 in Python. How can I do that? Currently, I am using python 2.5. Thank you in advance.

    Read the article

  • Error converting datetime to string

    - by user279521
    Hi, I am getting an error when I attempt to display a datetime value in a textbox: My code is: txtStartDate.Text = rdrGetUserInfo.IsDBNull(14) ? String.Empty : Convert.ToString(rdrGetUserInfo.GetString(14)); The error message is: ex.Message = "Unable to cast object of type 'System.DateTime' to type 'System.String'." Any ideas how I can resolve this?

    Read the article

  • Finding tags in query string with regular expression

    - by fatmatto
    Hi everybody! I have to set some routing rules in my php application, and they should be in the form /%var/something/else/%another_var In other words i beed a regex that returns me every URI piece marked by the % character, String marked by % represent var names so they can be almost every string. another example: from /%lang/module/controller/action/%var_1 i want the regex to extract lang and var_1 i tried something like /.*%(.*)[\/$]/ but it doesn't work.....

    Read the article

  • How do I convert byte to string?

    - by HardCoder1986
    Hello! Is there any fast way to convert given byte (like, by number - 65) to it's text hex representation? Basically, I want to convert array of bytes into (I am hardcoding resources) their code-representation like BYTE data[] = {0x00, 0x0A, 0x00, 0x01, ... } How do I automate this Given byte -> "0x0A" string conversion?

    Read the article

  • Place images byte into String is not working?

    - by Proyb2
    I tried on Flex 3, facing issue with uploading JPG/PNG image, trace readUTFBytes would return correct bytes length but tmpFileContent is trucated, it would only appear to have upload just 3 characters of data to the server through PHP script which made image unusable. I have no issue for non-images format. What is wrong here? var tmpFileContent:String = fileRef.data.readUTFBytes(fileRef.data.length); Is String capable of handle bytes?

    Read the article

  • What is wrong with this connection string?

    - by Hakan
    Can any one help me with this connection string. I can't manage how to fix. Dim constring As String Dim con As SqlCeConnection Dim cmd As SqlCeCommand constring = "(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + \\database.sdf;Password=pswrd;File Mode=shared read" con = New SqlCeConnection() con.Open() Thanks

    Read the article

  • How to combine array list string in java ?

    - by tiendv
    I have some arraylist string with keyword inside like that ! A windows is arraylist string with keyword is bold Struct of window : 9 words before + keyword + 9 words after You can see some window overlaping How to i combine that arraylist to receive like that : Thanks

    Read the article

  • Help me to split string with Regular Expression

    - by Lu Lu
    Hello, I have a string: CriteriaCondition={FieldName={*EPS}*$MinValue=(-201)$MaxValue=(304)$TradingPeriod=(-1)} Help me to get the first word which ends with the first word "={" & get the next following word which ends with "}". The result must be: Word1 = "CriteriaCondition" Word2 = "FieldName={EPS}$MinValue=(-201)$MaxValue=(304)$TradingPeriod=(-1)" And with the string "FieldName=(EPS)$MinValue=(-201)$MaxValue=(304)$TradingPeriod=(-1)", help me to split to pairs: FieldName EPS MinValue -201 MaxValue 304 TradingPeriod -1 Thanks.

    Read the article

< Previous Page | 136 137 138 139 140 141 142 143 144 145 146 147  | Next Page >