I'm trying to parse though a string made up of a single word.
How would you go about assigning the last letter of the word to a variable?
I was thinking of using the Scanner class to parse the word and make each letter an element in an array but it seems Scanner.next() only goes through whole words and not the individual letters.
Any...
I'm trying to create an "snippet" from a paragraph. I have a long paragraph of text with a word hilighted in the middle. I want to get the line containing the word before that line and the line after that line.
I have the following piece of information:
The text (in a string)
The lines are deliminated by a NEWLINE character \n
I have ...
For example I have code below
string txt="I have strings like West, and West; and west, and Western."
I would like to replace the word west or West with some other word. But I would like not to replace West in Western.
Can I use regular expression in string.replace? I used
inputText.Replace("(\\sWest.\\s)",temp); It dos not wor...
how do i strip comma from the end of an string, i tried
awk = subprocess.Popen([r"awk", "{print $10}"], stdin=subprocess.PIPE)
awk_stdin = awk.communicate(uptime_stdout)[0]
print awk_stdin
temp = awk_stdin
t = temp.strip(",")
also tried t = temp.rstrip(","), both don't work.
...
I would like to insert a line break into the first space between words in a string variable. Here is my code so far:
<cfset myPosition = find(" ", #myVar#)>
<cfset lineBreak = Chr(13)&Chr(10)>
<cfset myVar = insert(#lineBreak#, #myVar#, #myPosition#)>
What am I doing wrong?
...
Hi,
I am trying to design a function that essentially does as follows:
String s = "BLAH";
store the following to an array:
blah
lah
bah
blh
bla
bl
ba
bh
ah
al
So basically what I did there was subtract each letter from it one at a time. Then subtract a combination of two letters at a time, until there's 2 characters remaining. Store ...
I have a set of strings that contain within them one or more question marks delimited by a comma, a comma plus one or more spaces, or potentially both. So these strings are all possible:
BOB AND ?
BOB AND ?,?,?,?,?
BOB AND ?, ?, ? ,?
BOB AND ?,? , ?,?
?, ? ,? AND BOB
I need to replace the question marks with @P#, so ...
I have the following code in Java (which worked just fine in C++ for some reason) which produces an error:
int a;
System.out.println("String length: " + input.length());
for(a = 0; ((a + 1) * 97) < input.length(); a++) {
System.out.print("Substring at " + a + ": ");
System.out.println(input.substring(a * 97, 97));
//other co...
I have a string like
Pakistan, officially the <a href="Page.aspx?Link=Islamic Republic of Pakistan">Islamic Republic of Pakistan</a>
Now I am using
System.Text.RegularExpressions.Regex.Replace(inputText, "(\\bPakistan\\b)", "something");
to replace Pakistan outside the tags. But I don't want to replace Pakistan occurrin...
Hi,
I have some strings that I want to delete some unwanted characters from them.
For example: Adam'sApple ----> AdamsApple.(case insensitive)
Can someone help me, I need the fastest way to do it, cause I have a couple of millions of records that have to be polished.
Thanks
...
I want to remove the first characters from a string. Is there a function that works like this?
>>> a = "BarackObama"
>>> print myfunction(4,a)
ckObama
>>> b = "The world is mine"
>>> print myfunction(6,b)
rld is mine
...
I have a path say C:\Program Files\Borland
what would bet the easiest way to parse that string and just return Borland?
thanks
...
Running Coldfusion 8, I am trying to clean text input before saving to a database that will take things like the MS equivalent of ' " - and accented letters, and converting them.
I have tried replace, REReplace, and various UDFs found on the internet. None seem to work. In fact, I tried this:
<cfscript>
function cleanString(string)...
I know how to capitalize first letter in each word. But I want to know how to capitalize first letter of each sentence in C#.
...
Hi,
I'm looking at some external code and saw a line of Ruby code that looks like this
string_name = string_name[3..-1]
what does the [n..-x] do or mean?
Thanks.
...
Pay attentions that there is a space in it.
Which function can I use?
...
I am maintaining a legacy application which prints product labels on packaging. The format of the label is stored in a INI file. I wanted to know if anyone has any hints about the meaning of this format. I have pasted a snippet here.
{D1531,1000,1501|}
{C|}
{U2;0130|}
{D1531,1000,1501|}
{AX;+000,+000,+00|}
{AY;+05,0|}
{PC000;0922,0555,...
/^[^\s]+\s([^\s]+)\s/
In PHP,I can use regex to get the substr by $1,
how should I do it in C?
It's better if can do it without regex,though.
UPDATE
Put simply, how do I get werwerur out of swerwer werwerur y (the second)?
...
There may be an easy way to do this but I can't see it...
I created a simple Http Module that starts a timer on the PreRequestHandler and stops the timer on the PostRequestHandler to calculate the time it took the page to load.
I then create some simple html and write my results to Response.Write. Since I'm doing this in the PostReque...
I've got an AJAX transmission of a variable string in my primary coding language (Visual FoxPro 9) that looks like this:
AjaxResponse = CREATEOBJECT("Custom")
lcMessage = "<li class='hello'>Hello</li>"
AjaxResponse.AddProperty("Reply", lcMessage)
Response.ContentType = "text/html"
Response.Write(AjaxResponse.Rep...