List of substrings
I have big string, it can have a few thousands lines. I would like to to get all sub-strings like: [tag] here can be everything [/tag] in a list. How can I do this? My regex is not working (or I'm doing something wrong). ...
I have big string, it can have a few thousands lines. I would like to to get all sub-strings like: [tag] here can be everything [/tag] in a list. How can I do this? My regex is not working (or I'm doing something wrong). ...
I want to be able to generate a number of text files with the names fileX.txt where X is some integer: for i in range(key): filename = "ME" + i + ".txt" //Error here! Can't concat a string and int filenum = filename filenum = open(filename , 'w') Does anyone else know how to do the filename = "ME" + i part so I get a li...
Hey guys, i'm working on a program that gets a postfix expression and calculates it.. I have two functions: Converts infix to postfix Calculate the postfix When I try small expressions, like 1+1 or (1+1)*1, it works fine but when i use all the operands I get something nasty, Here is the example: 2*2/2+1-1 gets something like: 222/*...
I have a config file like this. [rects] rect1=(2,2,10,10) rect2=(12,8,2,10) I need to loop through the values and convert them to tuples. I then need to make a tuple of the tuples like ((2,2,10,10), (12,8,2,10)) ...
Not sure if I worded the title correctly, so my apologies. I want to simply convert an integer to strings that hold the binary representation of that integer. Example: 116 would convert to "1110100" Is there anything built into .Net or will I need to write a small parsing algorithm? ...
Example: MY NAME IS STACKOVERFLOW Results in: MY(new line) NAME(new line) IS(new line) STACKOVERFLOW(new line) or Example: MY-NAME-IS-STACKOVERFLOW Results in: MY(new line) NAME(new line) IS(new line) STACKOVERFLOW(new line) I want to split the line into multiple lines using either a space or dash or whatever it is. ...
I want to do something like IsItAStringLiteral("yes") var v = "no"; IsItAStringLiteral(v) With the obvious return value. Is it possible? ...
Is it possible to append query strings to the links created by the pagination class? Currently if you are on this page: http://127.0.0.1/~panayi/xryses/Nicosia/browse/Homes?price_low=19&price_high=300 the links are incorrectly generated as http://127.0.0.1/~panayi/xryses/Nicosia/browse/Homes&per_page=20 http://127.0.0.1/~pa...
I could have asked these 3 separately, but decided to merge them. I would like to ask for some expert opinion with examples on: how to properly validate a alphanumeric string? (only latin letters & numbers) how to properly validate a written unicode string? (like the above but any country letters allowed) how to properly validate that...
If I use any ASCII characters from 33 to 127, the codePointAt method gives the correct decimal value, for example: String s1 = new String("#"); int val = s1.codePointAt(0); This returns 35 which is the correct value. But if I try use ASCII characters from 128 to 255 (extended ASCII/ISO-8859-1), this method gives wrong value, for exam...
I have a C++ program, that calls Delphi DLL to initialize a buffer that contains chars. I am testing out the interface to make sure the data are passed correctly: In C++ program: char * pMsg = (char*)malloc(3); //allocate buffer Init(pMsg * char); //Delphi DLL function In Delphi DLL: procedure Init(pMsg:PChar); var pHardcodedMsg...
hi , I have 2 related questions. 1)suppose we have: string strMessage="\nHellow\n\nWorld"; console.writeln(strMessage); Result is: Hellow World Now if we want to show the string in the original format in One Line we must redefine the first variable from scratch. string strOrignelMessage=@"\nHellow\n\nWorld" ; co...
Have following Java code,that creates StringBuilder with "\n",i.e. carriage return delimiters: while (scanner.hasNextLine()){ sb.append(scanner.nextLine()).append("\n"); } It's occurred,that after last String(line) had "\n" symbol. How to gracefully remove last "\n" from resulting StringBuilder object? thanks. ...
Hi, I am trying to extract data from a xml file, get rid of the xml tags, and store the values in a txt file (tab delimited format) using C. I was able to extract and manipulate the string but I am unable to paste the string to the txt file in a tab delimited format. Instead of getting a txt file that should read like: x.xxxxxxx ...
When I try to split a string into a string list where each element represents a line of the initial string, I get the "square" character, which I think is a linefeed or something, at the start of each line, except the first line. How can I avoid that? My code is as follows: Dim strList as List(Of String) If Clipboard.ContainsText Then ...
I read a few posts about best practices for strings and character encoding in C++, but I am struggling a bit with finding a general purpose approach that seems to me reasonably simple and correct. Could I ask for comments on the following? I'm inclined to use UTF-8 and UTF-32, and to define something like: typedef std::string string8;...
How to search text usign php ? I means : <?php $text ="hello World!"; if ($text contains "world") { echo "True"; } ?> ...
I'm converting one of my old Perl programs to PHP, but having trouble with PHP's string handling in comparison to Perl. In Perl, if I wanted to find out if $string contained this, that or the_other I could use: if ($string =~ /this|that|the_other/){do something here} Is there an equivalent in PHP? ...
An array of Strings, names, has been declared and initialized. Write the statements needed to determine whether any of the the array elements are null or refer to the empty String. Set the variable hasEmpty to true if any elements are null or empty-- otherwise set it to false. hasEmpty=false; for (int i=0;i<names.length;i++) i...
So my teacher told me to make a string that makes whatever I type go in the opposite order (e.g. "hello there" becomes "ereht olleh"). So far I worked on the body and I came up with this public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { (The input needs to be in...