I have 3 text files
many lines of value1<tab>value2 (maybe 600)
many more lines of value2<tab>value3 (maybe 1000)
many more lines of value2<tab>value4 (maybe 2000)
Not all lines match, some will have one or more vals missing. I want to take file 1, read down it and lookup corresponding values in files 2 & 3, and write the output as -...
Hi,
I have this string s1 = "My name is X Y Z" and I want to reverse the order of the words so that s1 = "Z Y X is name My".
I can do it using an additional array. I thought hard but is it possible to do it inplace (without using additional data structures) and with the time complexity being O(n)?
cheers
...
The fact that the replace method returns a string object rather than replacing the contents of a given string is a little obtuse (but understandable when you know that strings are immutable in Java). I am taking a major performance hit by using a deeply nested replace in some code. Is there something I can replace it with that would ma...
I have a String which provides an absolute path to a file (inlcuding the file name). I want to get just the filename. What is the easiest way to do this.
It needs to be as general as possible as I cannot know in advance what the URL will be. I can't simply create a URL object and use getFile() - all though that would have been ideal if ...
We have a Java project which contains a large number of English-language strings for user prompts, error messages and so forth. We want to extract all the translatable strings into a properties file so that they can be translated later.
For example, we would want to replace:
Foo.java
String msg = "Hello, " + name + "! Today is " + day...
I'm looking for either a best practise or library for processing string into an object tree..
here is the example:
"[age] = '37' And [gender] Is Not Null And [optindate] > '2003/01/01' And [idnumber] Is Null And ([saresident] = '52' Or [citizenship] Like 'abc%')"
I should be able to objectize this into a tree something like this:
{at...
Does the System.Text.RegularExpressions namespace offer me anything to discover whether an input string has ("abc[0-9]" or "^aeiou$") or has not ("abc123") metacharacters? Or do I have to check manually for non-escaped characters in a certain list?
...
In PHP I would use this:
$text = "Je prends une thé chaud, s'il vous plaît";
$search = array('é','î','è'); // etc.
$replace = array('e','i','e'); // etc.
$text = str_replace($search, $replace, $text);
But the Java String method "replace" doesn't seem to accept arrays as input. Is there a way to do this (without having to resort to a f...
Suppose I have a string like this:
one two three "four five six" seven eight
and I want to convert it to this:
one,two,three,"four five six",seven,eight
What's the easiest way to do this in C#?
...
I have a text area where a user can enter free flow text. I want to separate out lines/occurrences in my Java class based on the below conditions:
When the user does not press the enter key, I want to get substrings (texts) of 10 characters each. When the user does press enter, I want to separate that part out and start again counting t...
I want to split a polynomial like:
2x^7+x^2+3x-9
Into each one of its terms (2x^7, x^2, 3x, 9)
I've thought about using String.split(), but how can I make it take more than one paramether?
...
I'm trying to either grab only part of this URL or inject part of a string into it (whichever is simplest).
Here's the URL:
http://www.goodbuytimeshare.com/listings/min:1000/max:150000/agreements:rent,buy/properties:apartment,condo,hotel,resort/show:4/
I figure I either need to be able to tim it down to:
/listings/min:1000/max:15000...
I have a text area wherein i have limited the user from entering more that 15 characters in one line as I want to get the free flow text separated into substrings of max limit 15 characters and assign each line an order number.
This is what I was doing in my java class:
int interval = 15;
items = new ArrayList();
TextIt...
Is there a straightforward way of finding the index of the last occurrence of a string using SQL? I am using SQL Server 2000 right now. I basically need the functionality that the .NET "System.String.LastIndexOf" method provides. A little googling revealed this - http://www.sqlservercentral.com/scripts/T-SQL+Aids/31116/ - but that doe...
Let's say I have a URL that looks something like this:
http://www.mywebsite.com/param1:set1/param2:set2/param3:set3/
I've made it a varaible in my javascript but now I want to change "param2:set2" to be "param2:set5" or whatever. How do I grab that part of the string and change it?
One thing to note is where "param2..." is in the ...
OK, so I'm working with a little regular expression—it's my first time, please, be gentle—and I've run into a problem where I can set a variable with it but if I try to do anything with that variable it causes problems.
Here's my script:
$(document).ready(function () {
var show_number;
var url_param;
$("a[rel=more]").live(...
I'm creating a theme for a CMS, and only have the ability to change the CSS associated with the page (no Javascript, PHP, etc).
Is there a way to change this list of users that we have:
JOHN SMITH DAVID JONES ...
into proper title case (John Smith, etc) using CSS?
text-transform: lowercase; works ok (john smith, etc) but text-tra...
Hi all!!
The below are the set of log data found in text file
**********************************************************************************
**2008/04/06** 00:35:35 193111 1008 O 9448050132# 74
**2008/04/06** 00:35:35 193116 1009 O ...
I would like to replace forward slaches to backslashes in emacs lisp.
If I use this :
(replace-regexp-in-string "\/" "\\" path))
I get an error.
(error "Invalid use of `\\' in replacement text")
So how to represent the backslash in the second regexp?
...
Are there particular cases where native text manipulation is more desirable than regex?
In particular .net?
Note:
Regex appears to be a highly emotive subject, so I am wary of asking such a question. This question is not inviting personal/profession opinions on regex, only specific situations where a solution including its use is not as...