Hi All,
I need JS that will remove any HTML tags, and then replace newlines with </p><p> and line breaks with <br/>. The string value is coming from a textarea and I understand Linux, Mac and Windows all format newlines differently so I need to take that into account. Thanks!
...
Hey there, I'm having trouble separating numbers and characters from my input string. The purpose of my program is to add,subtract,multiply and divide in postfix
so i cant predict the input form as it can be anything from
2 2 3 + * (answer being 10) to 2 2 + 3 * (answer being 12). So i cant use sscanf to extract the numbers and the opera...
If I have a string in Groovy like so...
'user.company.name'
... and I want to get the the word "company" and "name" from that string, what is the best way to go about it?
I was thinking of something like this, but I'm not sure if it's the most efficient/groovy way:
def items = 'user.company.name'.tokenize('.')
def company = items[-2...
I know how to do toString method for one dimensional arrays of strings, but how to print two dimensional array ? With 1D I do it this way :
public String toString() {
StringBuffer result = new StringBuffer();
res = this.magnitude;
String separator = "";
if (res.length > 0) {
result.append(res[0]);
for (i...
I have some basic idea on how to do this task, but I'm not sure if I'm doing it right. So we have class WindyString with metod blow. After using it :
System.out.println(WindyString.blow(
"Abrakadabra! The second chance to pass has already BEGUN! "));
we should obtain something like this :
e ...
I would like to replace the first character 'x' with the number '7' on every line of a log file using a shell script. Example of the log file:
216.129.119.x [01/Mar/2010:00:25:20 +0100] "GET /etc/....
74.131.77.x [01/Mar/2010:00:25:37 +0100] "GET /etc/....
222.168.17.x [01/Mar/2010:00:27:10 +0100] "GET /etc/....
My humble beginnings.....
I have the following text, I need to extract the exception name and the continuing sentence from the file, but the file has continuous sentences without a space.
??????>?????????????????????????????????????????????????????????????????????????????????????????????????????????????????
???????????????????????????????????????????????????????...
How do replace Every UpperCase Letter with Underscore and the Letter in C#?
note: unless the character is already proceeded by a underscore.
UPDATE:
For example,
MikeJones
would be turned into
Mike_Jones
But Mike_Jones
would not be turned into
Mike__Jones
Is Regex the best approach? Where do I start with this one?
...
If I have a string that looks like either
./A/B/c.d
OR
.\A\B\c.d
How do I get just the "./A/B/" part? The direction of the slashes can be the same as they are passed.
This problem kinda boils down to: How do I get the last of a specific character in a string?
Basically, I want the path of a file without the file part of it.
...
I have a java string which has an dollar value and cents value after decimal points and starting with a + or - sign. I want to convert into cents and store it in a integer (it can have + or -). Also i need to check if the cents part (after decimal point) not more than 2 digits and throw an error message if exists
example :
String dollv...
How to Split and strip X string values into separate variables?
X has string value of
itemA=myvalue&itemB=anothervalue&itemC=andanother
I have 3 strings (var1,var2,var3) to hold the values of the stripped values.
Find in string X "itemA=" copy everything after "=" character until "&" character OR if no "&" character is found copy u...
Hi all,
I have a set of data that contains garbled text fields because of encoding errors during many import/exports from one database to another. Most of the errors were caused by converting UTF-8 to ISO-8859-1. Strangely enough, the errors are not consistent: the word 'München' appears as 'München' in some place and also as 'MÃœnchen...
Currently I am doing this:
I have text that looks like:
Hello ${user.name}, this is ....
And I do this:
public string TransformUser(User user, string text)
{
StringBuilder sb = new StringBuilder(text);
sb.Replace("${user.name}", user.Name);
...
...
return sb.ToString();
}
Is there a better way, maybe using reflection ...
Is there something string class like stringbuilder in c#?
Thanks
...
I have a string which has the below content
String msg="The variables &CHAG_EF and &CHAG_DNE_DTE can be embedded in the description "
String test1="22/10/2010 00:10:12"
String test2 = "25/10/2010 00:01:12"
I need to search the string variable msg for the value "&CHAG_EF" and if it exists replace with the value of test1 and need ...
I have the below String assignment statement
String items[] = line.split("\",\"",15);
String fileNamet = items[1].replaceAll("\"","").trim();
I need to introduce a new if statement
if (valid) {
String items[] = line.split("\",\"",15);
} else {
String items[] = line.split("\",\"",16);
}
String fileNamet = items[1].replaceAll...
I know that i could return the index of a particular character of a string with indexof() function.
But how i could return the character with the particular index?
...
i have a text file with string "abcdef"
I want to search for the string "abc" in my test file ... and print the next two character for abc ..here it is "de".
how i could accomplish ?
which class and function?
...
I'm writing some code that takes a report from the mainframe and converts it to a spreadsheet.
They can't edit the code on the MF to give me a delimited file, so I'm stuck dealing with it as fixed width.
It's working okay now, but I need to get it more stable before I release it for testing.
My problem is that in any given line of dat...
How to continue from where I have been searching to find the index?
I am searching in a file to find the index of a character; then I have to continue from there to find the index of the next character. For example : string is " habcdefghij"
int index = message.IndexOf("c");
Label2.Text = index.ToString();
labe...