Thursday, November 19, 2009

Sandy - Eyak

Tuesday, November 10, 2009

international love fidel nadal

Saturday, November 07, 2009

Hisham Abbas - Betigy Osady

Thursday, October 29, 2009

nice Java..

http://pages.cs.wisc.edu/~hasti/cs302/examples/Parsing/parseString.html

Parsing Strings with split

Parsing

parsing
dividing a string into tokens based on the given delimiters
token
one piece of information, a "word"
delimiter
one (or more) characters used to separate tokens

When we have a situation where strings contain multiple pieces of information (for example, when reading in data from a file on a line-by-line basis), then we will need to parse (i.e., divide up) the string to extract the individual pieces.

Parsing Strings in Java

Strings in Java can be parsed using the split method of the String class. ( StringTokenizer can also be used to parse a string; we won't be covering it here). This just gives a brief overview (and some examples) of some of the common (and easiest) ways to use the split method; for more detailed information see the Java API documentation for split.

Issues to consider when parsing a string:

  • What are the delimiters (and how many are there)?
  • How should consecutive delimiters be treated?

When there is just one character used as a delimiter

Example 1

We want to divide up a phrase into words where spaces are used to separate words. For example

the music made   it   hard      to        concentrate
In this case, we have just one delimiter (space) and consecutive delimiters (i.e., several spaces in a row) should be treated as one delimiter. To parse this string in Java, we do
String phrase = "the music made   it   hard      to        concentrate";
String delims = "[ ]+";
String[] tokens = phrase.split(delims);

Note that

  • the general form for specifying the delimiters that we will use is "[delim_characters]+" . (This form is a kind of regular expression. You don't need to know about regular expressions - just use the template shown here.) The plus sign (+) is used to indicate that consecutive delimiters should be treated as one.
  • the split method returns an array containing the tokens (as strings). To see what the tokens are, just use a for loop:
    for (int i = 0; i < tokens.length; i++)
    System.out.println(tokens[i]);
    You should find that there are seven tokens: the, music, made, it, hard, to, concentrate

Example 2

Suppose each string contains an employee's last name, first name, employee ID#, and the number of hours worked for each day of the week, separated by commas. So

Smith,Katie,3014,,8.25,6.5,,,10.75,8.5
represents an employee named Katie Smith, whose ID was 3014, and who worked 8.25 hours on Monday, 6.5 hours on Tuesday, 10.75 hours on Friday, and 8.5 hours on Saturday. In this case, we have just one delimiter (comma) and consecutive delimiters (i.e., more than one comma in a row) should not be treated as one. To parse this string, we do
String employee = "Smith,Katie,3014,,8.25,6.5,,,10.75,8.5";
String delims = "[,]";
String[] tokens = employee.split(delims);

After this code executes, the tokens array will contain ten strings (note the empty strings): "Smith", "Katie", "3014", "", "8.25", "6.5", "", "", "10.75", "8.5"

There is one small wrinkle to be aware of (regardless of how consecutive delimiters are handled): if the string starts with one (or more) delimiters, then the first token will be the empty string ("").

When there are several characters being used as delimiters

Example 3

Suppose we have a string containing several English sentences that uses only commas, periods, question marks, and exclamation points as punctuation. We wish to extract the individual words in the string (excluding the punctuation). In this situation we have several delimiters (the punctuation marks as well as spaces) and we want to treat consecutive delimiters as one

String str = "This is a sentence.  This is a question, right?  Yes!  It is.";
String delims = "[ .,?!]+";
String[] tokens = str.split(delims);

All we had to do was list all the delimiter characters inside the square brackets ( [ ] ).

Example 4

Suppose we are representing arithmetic expressions using strings and wish to parse out the operands (that is, use the arithmetic operators as delimiters). The arithmetic operators that we will allow are addition (+), subtraction (-), multiplication (*), division (/), and exponentiation (^) and we will not allow parentheses (to make it a little simpler). This situation is not as straight-forward as it might seem. There are several characters that have a special meaning when they appear inside [ ]. The characters are ^ - [ and two &s in a row(&&). In order to use one of these characters, we need to put \\ in front of the character:

String expr = "2*x^3 - 4/5*y + z^2";
String delims = "[+\\-*/\\^ ]+"; // so the delimiters are: + - * / ^ space
String[] tokens = expr.split(delims);

General template for using split

String s = string_to_parse;
String delims = "[delimiters]+"; // use + to treat consecutive delims as one;
// omit to treat consecutive delims separately
String[] tokens = s.split(delims);

Monday, September 21, 2009

Myriam Fares

Thursday, September 17, 2009

http://www.youtube.com/user/jedastan18

http://www.youtube.com/user/jedastan18

just great stuff..

Tuesday, September 01, 2009

http://liveballlive.blogspot.com

http://liveballlive.blogspot.com

Wednesday, August 26, 2009

babes...


Sean Kingston - Fire Burning

Friday, August 21, 2009

olga farmaki

Wednesday, August 12, 2009

Space Cowboy - Falling Down

Sunday, August 09, 2009

Özgün - Zilli | 2009 Video Klip | HQ

Wednesday, July 29, 2009

Tuesday, July 28, 2009

Liking MEEBO More Now, With This .......


Sunday, July 19, 2009

you're such a disappointment to me.. all that strength... but no will to use it. What a waste.

Hilary Duff-any moment everything can change

Everyone. Everybody. I, uh... I wanna thank you all for coming here tonight and drinking all of my booze. No, really. Uh... There's a thing about being a Wayne that... you're never short of a few freeloaders, like yourselves, to fill up your mansion with, so, here's to you people. Thank you. Mm... I'm not finished. To all of you, uh, all you phonies, all of you two-faced friends, you sycophantic suck-ups who smile through your teeth at me, please leave me in peace. Please go. Stop smiling. It's not a joke. Please leave. The party's over. Get out.

Monday, June 15, 2009

jmejedi youtube

http://www.youtube.com/user/jmejedi

Saturday, June 13, 2009

Thursday, June 11, 2009

Love it !!

Tuesday, May 19, 2009

Sunday, May 17, 2009

Thursday, May 14, 2009

Learning Salsa....

http://www.youtube.com/watch?v=dBOjEARgu9U&feature=channel

http://www.youtube.com/watch?v=fbbb1vqwb4I&feature=channel

http://www.youtube.com/watch?v=RsUAJYYT7Jc&feature=PlayList&p=670EF362CF86589E&playnext=1&playnext_from=PL&index=4

Wednesday, May 13, 2009

Monday, April 20, 2009

Miranda Kerr

Wednesday, April 15, 2009

http://www.oxta-computing.com/

http://www.oxta-computing.com/

Wednesday, April 08, 2009

Taliana Vargas

Saturday, April 04, 2009

Cómo montar un negocio propio sin presupuesto....

http://www.wikilearning.com/articulo/como_montar_un_negocio_propio_sin_presupuesto-como_montar_un_negocio_propio_sin_presupuesto/16690-1

Awesome Links...

http://www.cromos.com.co/

http://www.revistadonjuan.com/revista.php?edicion=01-2009_ESP&articulo=1386

http://www.leonisausa.com/


:)

Tuesday, March 03, 2009

Que rico cancion...

Thursday, February 26, 2009

My Desktop... and an Avatar (made from my-desktop-background).......


Sunday, February 15, 2009

Monday, February 09, 2009

TOO FUNNY !!!!

Thursday, January 22, 2009

RevistaDONJUAN