Search Results

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

Page 121/1488 | < Previous Page | 117 118 119 120 121 122 123 124 125 126 127 128  | Next Page >

  • Removing Numbers from a String using Javascript

    - by Abs
    Hello all, How do I remove numbers from a string using Javascript? I am not very good with regex at all but I think I can use with replace to achieve the above? It would actually be great if there was something JQuery offered already to do this? //Something Like this?? var string = 'All23'; string.replace('REGEX', ''); I appreciate any help on this.

    Read the article

  • Converting a string into a CheckBox

    - by Chris
    I have a string which is ultimately the id of a CheckBox. What I need to be able to do is to access the CheckBox's properties from the string var myCheckBox:Object; var myString:String; myString = "checkbox_1" myCheckBox = Object(myString); ?!?! ... and then I'd need to get to myCheckBox.selected, and myCheckBox.label etc

    Read the article

  • how to find and add a string to a file in linux

    - by user2951644
    How can I check a file for a string if missing the string automatically add it for example Input Input file test.txt this is a test text for testing purpose this is a test for testing purpose this is a test for testing purpose this is a test text for testing purpose I would like to add "text" to all the lines Desired Output this is a test text for testing purpose this is a test text for testing purpose this is a test text for testing purpose this is a test text for testing purpose Is it possible? many thanks in advance Hi guys thanks for all the help, for my case is not that simple. I wont know which line will be different and in the middle string it will not only have a single string. i will give a clearer case Input file test.txt Group: IT_DEPT,VIP Role: Viewer Dept: IT Group: IT_DEPT,VIP Dept: IT Group: FINANCE LOAN VIEWER Role: Viewer Dept: FINANCE Group: FINANCE LOAN VIEWER Dept: FINANCE Desired output file test2.txt Group: IT_DEPT,VIP Role: Viewer Dept: IT Group: IT_DEPT,VIP Role: - Dept: IT Group: FINANCE LOAN VIEWER Role: Viewer Dept: FINANCE Group: FINANCE LOAN VIEWER Role: - Dept: FINANCE So those that are missing "Role:" will be added "Role: - ", hope this clear things out, thanks in advance again

    Read the article

  • Indexing through Android string resources

    - by gssi
    OK, I've got the code to allow me to index through the string resources. Now, how do I get the value of a specific resource item without knowing its name? Here's the index loop: Field[] fLst = R.string.class.getFields(); for(Field f : fLst){ Log.i(dbgTag, "Field Entry: R.string." + f.getName()); } Thanks for your efforts ...

    Read the article

  • How to print string in this way

    - by xRobot
    For every string, I need to print # each 6 characters. For example: example_string = "this is an example string. ok ????" myfunction(example_string) "this i#s an e#ample #string#. ok ?#???" What is the most efficient way to do that ?

    Read the article

  • JComboBox to string

    - by gabrielle fregil
    I have a String array of names, and then I added it into an editable JComboBox. The user can either pick his/her name from the choices or just input his/her name if not in the choices. How do I put the user input into a new string variable? String [] chooseName = { Mark, John, Allison, Jessica }; JComboBox combo = new JComboBox (chooseName); combo.setEditable(true); String chosenName = /* how do i place what the user inputed here? */

    Read the article

  • How can I put a string and an integer into the same array?

    - by Stelios M
    I have to following code. I want this to return an array e.g. arg[] that contains at arg[0] the number of the rows of my cursor and at arg[1] String(0) of my cursor. Since one is integer and the other is string I have a problem. Any ideas how to fix this? public String[] getSubcategoriesRow(String id){ this.openDataBase(); String[] asColumnsToReturn = new String[] {SECOND_COLUMN_ID,SECOND_COLUMN_SUBCATEGORIES,}; Cursor cursor = this.dbSqlite.query(SECOND_TABLE_NAME, asColumnsToReturn, SECOND_COLUMN_SUBCATEGORIES + "= \"" + id + "\"", null, null, null, null); String string = cursor.getString(0); int count = cursor.getCount(); String arg[] = new String[]{count, string}; cursor.close(); return arg; } The cursor and the results and correct i just need to compine them to an array in order to return that.

    Read the article

  • Regex vs. string:find() for simple word boundary

    - by user576267
    Say I only need to find out whether a line read from a file contains a word from a finite set of words. One way of doing this is to use a regex like this: .*\y(good|better|best)\y.* Another way of accomplishing this is using a pseudo code like this: if ( (readLine.find("good") != string::npos) || (readLine.find("better") != string::npos) || (readLine.find("best") != string::npos) ) { // line contains a word from a finite set of words. } Which way will have better performance? (i.e. speed and CPU utilization)

    Read the article

  • Returning string in java using 3 parameters

    - by user2905118
    Need to write a method describePerson() that takes 3 parameters, a String giving a person’s name, a boolean indicating their gender (true for female, false for male), and an integer giving their age. The method should return a String formatted as in the following examples: Lark is female. She is 2 years old. Or Jay is male. He is 1 year old. I am not sure how to write it correctly (my code): int describePerson(String name, boolean gender, int age) { String words=""; if(gender==true) return (name + "is "+gender+". "+"She is"+age+ "years old.); else return (name + "is "+gender+". "+"She is"+age+ "years old.); } The outcome "year" and "years" is also differs, but i don't know how to make it correct..

    Read the article

  • Serialization of a TChan String

    - by J Fritsch
    I have declared the following type KEY = (IPv4, Integer) type TPSQ = TVar (PSQ.PSQ KEY POSIXTime) type TMap = TVar (Map.Map KEY [String]) data Qcfg = Qcfg { qthresh :: Int, tdelay :: Rational, cwpsq :: TPSQ, cwmap :: TMap, cw chan :: TChan String } deriving (Show) and would like this to be serializable in a sense that Qcfg can either be written to disk or be sent over the network. When I compile this I get the error No instances for (Show TMap, Show TPSQ, Show (TChan String)) arising from the 'deriving' clause of a data type declaration Possible fix: add instance declarations for (Show TMap, Show TPSQ, Show (TChan String)) or use a standalone 'deriving instance' declaration, so you can specify the instance context yourself When deriving the instance for (Show Qcfg) I am now not quite sure whether there is a chance at all to serialize my TChan although all individual nodes in it are members of the show class. For TMap and TPSQ I wonder whether there are ways to show the values in the TVar directly (because it does not get changed, so there should no need to lock it) without having to declare an instance that does a readTVar ?

    Read the article

  • How to remove strings of certain lengths

    - by Macosx Iam
    So I have this array, and I want to delete strings that are 2 or 4 characters in length (strings that contain 2 or 4 characters). I am doing this method, and it doesn't work, even though logically, it SHOULD work. public static void main(String[] args) { ArrayList<String> list = new ArrayList<String>(); list.add("This"); list.add("is"); list.add("a"); list.add("test"); for (int i=0; i<list.size(); i++) { if(list.get(i).length()==2 || list.get(i).length()==4) { list.remove(i); } } } I'd like to stick to this method of doing it. Can you please give me some suggestions as to how to correct this code? The output of this code when I run it is: [is, a] Even though I want the output to be [a] because "is" is 2 characters long.

    Read the article

  • Default string arguments

    - by John.M
    myPreciousFunction(std::string s1 = "", std::string s2 = "") { } int main() { myPreciousFunction(); } can i make the arguments look any more prettier? i want there to be empty string if no arguments were supplied.

    Read the article

  • Which substring of the string1 matches with the string2.

    - by Harikrishna
    There are two strings. String str1="Order Number Order Time Trade Number"; String str2="Order Tm"; Then I want to know that str2 matches with which substring in the str1. string regex = Regex.Escape(str2.Replace(@"\ ", @"\s*"); bool isColumnNameMatched = Regex.IsMatch(str1, regex, RegexOptions.IgnoreCase); I am using regex because "Order Tm" will also matches "Order Time".It gives bool value that matches occurred or not. Like str2="Order Tm" then it should return like in the str1,Order Time is the substring where matches is occurred.

    Read the article

  • c# unicode string output

    - by Reg
    I have function to convert string to a Unicode string: private string UnicodeString(string text) { return Encoding.UTF8.GetString(Encoding.ASCII.GetBytes(text)); } But when I am calling this function the output result is wrong. It looks like my function is not working. Console.WriteLine(UnicodeString("????? ?????")) printing on console just questions like that: ????? ???? Is there any way to say to console to display it correct? UPDATE Looks like the problem not in Unicode, I think may be it is displaying question marks because i am not having correct locale in the system (Windows 7)? Is there any way to make it work without changing locale?

    Read the article

  • Javascript replace query string + with a space

    - by BruceClark
    I'm grabbing the query string parameters and trying to do this: var hello = unescape(helloQueryString); and it returns: this+is+the+string instead of: this is the string Works great if %20's were in there, but it's +'s. Any way to decode these properly so they + signs move to be spaces? Thanks.

    Read the article

  • find string from the file in somewhere

    - by lightmanhk
    I want to find a string from some file in subdirectory. Like we are in bundle/. and in bundle/ there are multiple subdirectories and multiple txt files I want to do something like find . -type f -exec grep "\<F8\>" {} \; want to get the file where it contain string < F8 this command does work, find the string, but never return filename I hope anyone can give me a better solution to this, like display filename along with the line containing that string

    Read the article

  • Why System.String's beahaves like a value type?

    - by Sorush Rabiee
    I want to write a 'Date' class that behaves like a Value Type. for example, Instead of writing a Clone method for setting properties safely, make the Date class to pass by value: public Date Birthday { get { return this.birthday; } set { this.birthday = value.Clone(); } //I want to write this.birthday = value; //without changing external value when this.Birthday changes } I know this is possible because System.String is a class and behaves like a value. for example: String s1 = "Hello"; String s2 = "Hi"; s1 = s2; s2="Hello"; Console.WriteLine(s1); //Prints 'Hi' First I thought writers of this class override '=' operator, but now I know that the '=' operator can not be overridden. so how they write String class?

    Read the article

< Previous Page | 117 118 119 120 121 122 123 124 125 126 127 128  | Next Page >