The input is string[] like below.
"CSE111: CSE110 MATH101"
"CSE110:"
I need to order the strings based on some logic. For example my output should be a string[] like
"CSE110","MATH122","CSE111"
My question is
While scanning through the input array, if one string is picked to be the first string of the output array, ...
Hello all,
If I have a string in a div
<div id="article">
lots of text goes here
<strong> it's really interesting</strong>
and it's free to read
</div>
if a user double click or single click on a particular word, is there a way to determine the position/index of the character clicked?
If that cannot be done, how about determining ...
$('img').click(function(){
var add_to_list = $(this);
// database query for element
});
Currently add_to_list is getting the value 'images/image.jpg'. I want to replace the 'image/' to nothing so I only get the name of the picture (with or without the extension). How can I do this? I couldn't find anything. Also please provide ...
Why String.equls() returns true but Stringbuilder.equals() returns false?
StringBuffer sb1 = new StringBuffer("Amit");
StringBuffer sb2= new StringBuffer("Amit");
String ss1 = "Amit";
String ss2 = "Amit";
System.out.println(sb1.equals(sb2)); //returns false
System.out.println(ss1.equals(ss2)); //returns true
Thx
...
How do I remove a character from an element in a list?
Example:
mylist = ['12:01', '12:02']
I want to remove the colon from the time stamps in a file, so I can more easily convert them to a 24hour time. Right now I am trying to loop over the elements in the list and search for the one's containing a colon and doing a substitute.
fo...
I'm trying to make an in statement with values coming from DB and then use them in another query. DB is Oracle
Example:
I've been beating my head around this for quite some time now. I need some help:
Groovy Code:
def myList = []
def myQuery = "select USER_ID from USER_TABLE where rownum < 3"
println myQuery
sql_dw.eachRow(myQuery) {...
What will be the best way using javascript regular expression to get numbers out of text..
e.g.... I have "$4,320 text/followme" and I want to get 4320 out of this. However I want to avoid numbers after first occourance of an alphabet or any non alphabet other than a comma ','
so that if i have $4,320 t234ext/followme it will still ret...
Hello.
I created an application to send mail to users.
I'm using a database where some users have more than one email address assigned.
Name Mail
-----------------------------------------
BusinessXPTO [email protected];[email protected]
The email column can contain more than one email, separated by a semicolon.
I...
Hello,
I would like to replace the link location (of anchor tag) of a page as follows.
Sample Input:
text text text <a href='http://test1.com/'> click </a> text text
other text <a class='links' href="gallery.html" title='Look at the gallery'> Gallery</a>
more text
Sample Output
text text text <a href='http://example.com/p.php?q=...
I'd like to remove the leading whitespace in a string, but without removing the trailing whitespace - so trim() won't work. In python I use lstrip(), but I'm not sure if there's an equivalent in Java.
As an example
" foobar "
should become
"foobar "
I'd also like to avoid using Regex if at all possible.
Is there a built...
I want to match following pattern:
key="value" key="value" key="value" key="value" ...
where key and value are [a-z0-9]+, both should be grouped (2 groups, the " - chars can be matched or skipped)
input that should not be matched:
key="value"key="value" (no space between pairs)
For now I got this(not .NET syntax):
([a-z0-9]+)...
it may seem simple but it posses lots of bugs
I tried this way:
String s = gameList[0].toString();
s.replaceFirst(String.valueOf(s.charAt(0)),String.valueOf(Character.toUpperCase(s.charAt(0))) );
and it throws an exception
another try i had was :
String s = gameList[0].toString();
char c = Character.toUpperCase(gameList[0].charA...
I have a string which I'd like to remove the end of line characters from the very end of the string only using Java
"foo\r\nbar\r\nhello\r\nworld\r\n"
which I'd like to become
"foo\r\nbar\r\nhello\r\nworld"
(This question is similar to, but not the same as question 593671)
...
Java's string split(regex) function splits at all instances of the regex. Python's partition function only splits at the first instance of the given separator, and returns a tuple of {left,separator,right}.
How do I achieve what partition does in Java?
e.g.
"foo bar hello world".partition(" ")
should become
"foo", " ", "bar hello ...
I've got lots of address style strings and I want to sort them in a rational way.
I'm looking to pad all the numbers in a string so that: "Flat 12A High Rise" becomes "Flat 00012A High Rise", there may be multiple numbers in the string.
So far I've got:
def pad_numbers_in_string(string, padding=5):
numbers = re.findall("\d+", stri...
i would like to take any input string and delimit it into groups. each group may be at least one character and no more than 4 characters. How do I loop to create all possible combinations?
Example:
in-string:
xoox
output:
x|o|o|x, x|oo|x, x|oox, xo|o|x, xo|ox, xoo|x, xoox
I'm writing an asp .net app using VB, but I really just need t...
If I have an NSString with something like this in it: Note Title Here:@:Note Description Here:@:123839:@:High Priority
How can I separate out the strings between the ":@:" characters? I would know how many segments to expect if using something other than an array/for-loop would be easier.
Thanks!
...
I've been researching on finding an efficient solution to this. I've looked into diffing engines (google's diff-match-patch, python's diff) and some some longest common chain algorithms.
I was hoping on getting you guys suggestions on how to solve this issue. Any algorithm or library in particular you would like to recommend?
Thanks.
...
Oracle 8 SQL: I do have data like "VTR 564-31 / V16 H12 W08 E19 L14" from which I want to trim the second part => "VTR 564-31"
According to this website I can use the rtrim function
rtrim('123000', '0'); would return
'123'
like this it works, but adapted to my use case, the following one does not trim at all? Do I have to escap...
it happens that the user click on enter where i dont want to include it as a part of my input the string can end with 3 times \n so just replacing one wont do the job
my solution was ;
String values[] = string_Ends_With_Back_Slash_N.split("\n");
String String_without_Back_Slash_N =new String (values [0]);
//or just to point there with...