I have a string with the following e.g.
$workingFile = '/var/tmp/A/B/filename.log.timestamps.etc';
And two strings representing a dirs e.g.
$dir = '/var/tmp';
$newDir = '/users/asdf';
I'd like to get the following:
'/users/asdf/A/B/filename.log.timestamps.etc'
However my Perl isnt up to much .. any pointers ?
Thanks
W
I have a bit of text
"this is the text want I want to do is replace the text, I have just added another is for good measure"
This is stored as a standard string but I want to turn this into html and add css classes like, in this example wrapping around the word "is";
"this is the text want I want to do
is replace the text, I have just added another is for good measure"
Any ideas how I can do this in as3?
i would like to delete a string or a line inside a ".txt" file ( i.e. filen.txt
). For example, i have these lines in the file:
1JUAN DELACRUZ
2jUan dela Cruz
3Juan Dela Cruz
then delete the 2nd line (2jUan dela Cruz), so the ".txt" file will look like:
1JUAN DELACRUZ
3Juan Dela Cruz
Please help.Thank you
Yes, There's More Than One Way To Do It™, but what is the most canonical, most efficient, and most concise methods to read an entire file into a string? (The latter two are perhaps at odds.)
There are Python code available for existing algorithms for normal string searching e.g. Boyer-Moore Algorithm. I am looking to use this on Chinese characters and it doesn't seem like the same implementation would work. What would I go about doing in order to make the algorithm work on Chinese characters? I am referring to this:
http://en.literateprograms.org/Boyer-Moore_string_search_algorithm_(Python)#References
Is it possible to store encrypted connection string so it can be used from server-side vbscript?
Was there an equivalent of web.config in 'the good old days'?
I am developing a c# web application with VS 2008 where I am trying to capture the physical path of the selected file. Using IE, I am finally able to retrieve this now in text variable. But I want to capture this information in string. How do I do this?
Currently I am using:
lb3.Text = Page.Request.PhysicalPath;
And it gives me:
Text = "C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\AddFileToSQL\AddFileToSQL\Default.aspx"
Given a string consisting of a single character followed by a number (one or two digits), I would like to split it into a character and an integer. What is the easiest way to accomplish this?
I m curious why would i use string formatting while i can use concatenation such as
Console.WriteLine("Hello {0} !", name);
Console.WriteLine("Hello "+ name + " !");
Why to prefer the first one over second?
I am getting a string from the user and then doing some checking to make sure it is valid, here is the code I have been using;
char digit= userInput.charAt(0) - '0';
This had been working fine until I did some work on another method, I went to compile and have been receiving a 'possible loss of precision' error since then.
What am I doing wrong?
Hi there,
I have a piece of text that gets handed to me like:
here is line one\n\nhere is line two\n\nhere is line three
What I would like to do is break this string up into three separate variables.
I'm not quite sure how one would go about accomplishing this in python.
Thanks for any help,
jml
1) Is there any built-in which can tell me if a variable's contents contain only uppercase letters?
2) is there any way to see if a variable contains a string? For example, I'd like to see if the variable %PATH% contains Ruby.
Given a string
'1.2.3.4.5'
I would like to get this output
'1.2345'
I wrote this
function process( input ) {
var index = input.indexOf( '.' );
if ( index ) {
input = input.substr( 0, index + 1 ) +
input.slice( index ).replace( /\./g, '' );
}
return input;
}
Live demo: http://jsfiddle.net/EDTNK/
It works but I was hoping for a slightly more elegant solution...
They're both resizable arrays, and std::basic_string doesn't have any specifically character-related functions like upper(). What's special about string to make it better for character data?
In a JVM the memory is split into Method Area ,Stack ,Heap , Temp and Registry . what is String Local Memory ? Does this exists ? If so when does it gets allocated or assigned ?
Appropriate Usage of this ?
Thanks
I'm reading a sourcefile in Java, but when I print it (sysout), the escaped characters are no longer escaped. How can I escape characters like \n and \t in a string in Java?
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 occurring within the <a></a> tags.
What query is suitable to compare two tables specied below, however only part of string in location(table1) will matches with the Location(table2).
Location(table1) Location(table2)
india- north USxcs
India-west Indiaasd
India- east Indiaavvds
India- south Africassdcasv
US- north Africavasvdsa
us-west UKsacvavsdv
uk- east Indiacascsa
uk- south UScssca
Africa-middle Indiacsasca
Africa-south Africaccc
Africa-east UKcac
only 1st two characters of location(table1) and 1st two characters of location(table2) should match. Please help
only any four characters of location(table1)and any two characters of location(table2)should match.
Hi everyone,
I am getting a difference when comparing two string which are 0 and '0' in PHP. Can I do anything to make them be compared equally in an if action?
Thanks!
Hi all!
I Use this code:
NSString* strName = [NSString stringWithFormat:@"img_00%d.jpg", pp];
and works fine, but if pp took the value of 10 for example I wish have img_010.jpg as result, and not img_0010.jpg...
how can I format the string??
thanks
string s = "????";
wstring ws = FUNCTION(s, ws);
How would i assign the contents of s to ws?
Searched google and used some techniques but they can't assign the exact content. The content is distorted.
i have a string of the format SUCCESS,12:34:56:78:90, i want to separate these two values that are separated by commas into two different strings. how do i do that in gcc using c language.