I am trying to check if a string ends in "@something" and extract "something" from it if it does. For example, I am trying to do something like this:
string temp = "//something//img/@src"
if (temp ends with @xxx)
{
string extracted = (get "src");
...
}
else
{
...
}
How can I accomplish this?
...
How can I count the number of times a particular string occurs in another string. For example, this is what I am trying to do in Javascript:
var temp = "This is a string.";
alert(temp.count("is")); //should output '2'
...
Hi
I'm trying to make a method that shall help me to spell world right. After addChar have return its work based on the input "famili", I want the result array to contain the word "familiy". Now the method removes a character from the string and replace it with the current char in alpha[], can someone please give me some help to make th...
When setting issue estimates in JIRA, you can enter a string like "1d 2h 30m" and JIRA will translate this (I'm assuming) into a corresponding number of milliseconds.
Is there an available Java library that does this?
I'm using a Spring managed bean that takes a property indicating how often a directory ought to be purged, and I'd like...
what is the difference between the string and character array.
how can each element of the string be accessed in C++.
...
I have a program which needs to be able to search through an ArrayList of 'book' objects, and decide which ones meet given criteria.
You can search by Name, ID Number, or Year published.
Or just by any assortment of the above.
Currently i use nested if statements, where a null value means that field wasn't specified and to display all...
Possible Duplicate:
concatenating string
I posted a similar question earlier and asked about using SQL server to output the result with a single quote. Could someone edcuate me please?
select ' ' + CustomerID + ','
from dbo.Customers
customerid
------------
ALFKI,
ANATR,
ANTON,
AROUT,
BERGS,
Would like to see the ...
In a string, replace every occurrence of <0xYZ> with the character of hex value YZ. The < and > characters will be used only for that purpose, the string is guaranteed to be well formatted.
Example ('0' = 0x30): A<0x30>B => A0B
It's an easy task, but there are many solutions and I was wondering about the best way to do it.
...
Hi,
I am newbie in python and facing some problem , my problem is that how to insert some fields in already existing string
for example:
suppose i have read one line from any file which contains:
line=Name Age Group Class Profession
now i have to insert 3rd Field(Group) 3 times more in the same line before Class field...
First consider this sample C++ code:
std::string input1, input2, input3;
std::cout << "Enter Input 1: ";
std::cin >> input1;
std::cout << std::endl << "Enter Input 2: ";
std::cin >> input2;
std::cout << std::endl << "Enter Input 3: ";
std::cin >> input3;
If for input1 I enter something like "Good day neighbors" then input1 is set to "...
Hello, i have a method which gets a string and a Hashtable ... the hash contains the char to be replaced in the key and the value which goes instead as value. Whats the best way to check the hash and replace the chars in the string?
Thanks :)
...
Im a bit stumped on how to make a string uppercase in php while not making the markup uppercase.
So for example:
<p>Chicken & <a href="/cheese">cheese</a></p>
Will become
<p>CHICKEN & <a href="/cheese">CHEESE</a></p>
Any advice appreciated, thanks!
...
does anyone know an elagant way of turning this string (the list is not definite.. the "keys" and "values" can be added arbitrarily)
business_type,cafe|business_type_plural,cafes|sample_tag,couch|business_name,couch cafe
into this array?
array(
[business_type]=>'cafe'
[business_type_plural] => 'cafes'
[sample_tag]=>'co...
I need to convert some data stored as varchar in a SQL Server database that I want to change from CamelCase to delimiter-separated. I know how to do this trivially in C# but not T-SQL. Any ideas?
...
I'm trying to get back into programming, specifically console games. I'd heard that curses was good for that, so I found a curses tutorial and I'm getting into that. I'm using C++, and naturally I wanted to take advantage of std::string, but functions like getstr() only accept char*. Is there any way to pass a string as a char*, or am I ...
I was looking for a way to replace instances of
[number][char] or [char][number] like it occurs in mathematical expressions (e.g. 4x + 20y)
with [number]*[char] or [char]*[number],
I have two problems with that
How do i reuse the found number and char => `replaceAll("[0-9999][a-z]", "[1]*[2]")` ?
Whats the best way to represent a num...
The class project has us reading in the title, artist and lyrics of 10,514 songs contained in a single text file. The current section of the project had us write an ordered unrolled linked list and run a search on the title field. The comparator was also written to sort the list by title. We have to keep track of the comparisons requi...
Imagine we have a long string containing the substrings 'cat' and 'dog' as well as other random characters, eg.
cat x dog cat x cat x dog x dog x cat x dog x cat
Here 'x' represents any random sequence of characters (but not 'cat' or 'dog').
What I want to do is find every 'cat' that is followed by any characters except 'dog' and the...
I maintain an open source program that builds with autoconf.
Right now I'm having a problem with some of my users. They are using a pre-distributed VM from an organization that has an incorrect prototype for strchr in it. Their prototype is:
char *strchr(char *,int c);
when of course we know it should be:
char *strchr(const char *s...
Given a block of text, I need to parse it for the existing of a keyword. Then on the first appearance of the keyword, I need to wrap bold tags around it (if it doesn't already have them), on the second appearance of the keyword, italics, and on the third, underline.
Example using the keyword "help":
This is some text with the keyword "...