For example...
s = 'The fox jumped over a big brown log.'
k = FUNCTION(s,4)
k should be... "The fox jumped over"
I can write my own function that splits on whitespace, cuts the list and then joins the list. But that is too much work.
Anyone else knows a simpler way?
...
I hoping for some pointers on the quickest way to do a replace when the document that needs bits replacing is constant (a sort of mailmerge scenario).
Of course there are lots of ways of doing replaces using string.replace and regexp but it looks like they need to parse the input document each time looking for the match. That's the bit ...
Say I have an array of Strings declared like this:
String[] strings = new String[ 1024 ];
And given an array of key value pairs declared like this:
KeyValuePair<String, String>[] pairs = new KeyValuePair<String, String>[ 50 ];
What are the possible workarounds for a solution that would do this:
for ( int i = 0; i < 1024; ++i )
{
...
I'm looking for references on separating a name: "John A. Doe" in parts, first=John, middle=A., last=Doe. In Mexico we have paternal, maternal, first and second given names, and can be written in different permutations, so the problem is quite complex.
As it depends on data, we are working with matching software that calculates a score ...
this section of code is supposed to make a list containing the values of the second column in the text file, but it takes the second letter. anyone know what my problem is?
TEXTFILE
opi 60
kid 60
pou 60
ret 60
kai 60
bob 100
for line in lst:
line.split(' ')
fire.append(int(line[1]))
...
I was wondering if it is possible to open an xml file as a plain text file so I can read in each line and manipulate the text?
...
All,
I am trying to find a similar function to 'strstr' that searches a substring starting from the end towards the beginning of the string.
Thanks
...
for example, can i do this:
split = temp_string.Split("<beginning of record>")
those of you recommended:
split = Regex.Split(temp_string, "< beginning of record >")
its not working. its just returning the first char "<"
and those of you that recommended:
Dim myDelims As String() = New String(){"< beginning of record >"}
split = t...
I have fooled around with regex but can't seem to get it to work. I have a file called includes/header.php I am converting the file into one big string so that I can pull out a certain portion of the code to paste in the html of my document.
$str = file_get_contents('includes/header.php');
From here I am trying to get return only th...
I am trying to compare two strings in Smalltalk, but I seem to be doing something wrong.
I keep getting this error:
Unhandled Exception: Non-boolean receiver. Proceed for truth.
stringOne := 'hello'.
stringTwo := 'hello'.
myNumber := 10.
[stringOne = stringTwo ] ifTrue:[
myNumber := 20].
Any idea what I'm doing wrong?
...
I'm having some trouble inserting a tab between two strings.
stringOne := 'Name'.
stringTwo := 'Address'.
I've tried:
info := stringOne, String tab, stringTwo.
or
info := stringOne, Character tab asString, stringTwo.
But none of those two messages are understood. I'm using Visual Works.
...
I have never found a neat(er) way of doing the following.
Say I have a list/array of strings.
abc
def
ghi
jkl
and I want to concatenate them into a single string delimited by a comma as follows:
abc,def,ghi,jkl
In Java, if I write something like this (pardon the syntax)
String[] list = new String[] {"abc","def","ghi","jkl"};
Str...
Hi,
In the application there is a string in the following format:
String elements = "[11, john,][23, Adam,][88, Angie,]..." (... means there are more elements in the string)
From the given string I have to create an ArrayList for name IDs (11, 23, 88, ...) and ArrayList for names (john, Adam, Angie, ...)
I created two methods:
priv...
Is it any faster to use
myString.replace(/foo/g,"bar")
rather than
myString.split("foo").join("bar")
for long strings in ActionScript 3? Or are they just two comparable methods of achieving the same result?
...
string exeFile = (new System.Uri(Assembly.GetEntryAssembly().CodeBase)).AbsolutePath;
string exeDir = Path.GetDirectoryName(exeFile);
string fileName = Path.Combine(exeDir, @"..\..\xml\SalesOrderXMLData.csv.xml");
Hello,
The above code works if the project is in, for example,
C:\Code\
but not if its in
C:\Documents and S...
I'm having an issue extracting a substring in SQL query results.
Here's the situation: I have a column that contains strings in the following format "ax123456uhba", "ax54232hrg", "ax274895rt", "ax938477ed1", "ax73662633wnn2"
I need to extract the numerical string that is preceded and followed by letters. However, occasionally there is...
When I run this code, About half-way through the concatenation loop, $xml becomes null and remains null throughout the rest of the concatenation loop. Has anyone else ran into this? Or see why this is happening?
$xml = '';
foreach($this->currentColumns['unknown'] as $column => $value)
{
$xml .= "<columnName>";
$xml .= $column;
...
This question sounds outrageous, but VS is giving me an error when I check that a string length is greater than zero:
options[j]["pdprice"].ToString().Length > 0
Saying:
CS0019: Operator '>' cannot be applied to operands of type 'string' and 'int'
Can someone please explain why I cannot check that an integer length property is g...
I have the text from a PDF document available to me, and I want to display snippets from the text everywhere the user-entered search phrase appears. Say the search term is"iphone", I want to display 200 characters around each iphone word instance in the document. Ideally, the snippet should also start from the beginning of a sentence. ...
i have field X that contain text with spaces in the end of the text
how i can remove them ?
i need it in any sql query for oracle 10g
...