Split by space
I have a string which I wanted to split by a space, how could I do that?
I have a string which I wanted to split by a space,
how could I do that?If you mean something like "Annie is a looney girl" should result into "Annie", "is", "a", "looney", "girl"... use StringTokenizer. :)
Similar Messages
-
Understanding distribution of space in a disk group - HP EVA
Dear Friends,
I have been ripping my hairs apart for the last 1 month trying to understand how EVA works in order to split the space into different RSS (vRAID0,vRAID1,vRAID5,vRAID6) in a disk group. I work for a company who has got HP EVA P6550 SAN in their environment. We have M6625 enclosures and 300GB 15K SAS disks. Yesterday we installed the 13th enclosure (our boss has ordered 5 new disk enclosures), i have told him that we can only add 18 enclosures on the P6550. We are getting multiple requests from different projects for storage space (10TB, 15TB, 13TB and so on). Most of these requests mention that they require RAID5 redundancy from SAN level. We have 3 disk groups defined in our SAN and we usually add new disks to these disk groups. What i do not understand is that the moment i add disks to existing disk groups , i can see vRAID0 RSS in the disk group is going on increasing , whereas vRAID5 and vRAID1 increase rarely. As i mentioned before whenever we create LUNs (vDISKS) we assign it to be vRAID5. In this situation what can i do in case i do not want to add any further space on vRAID0 since i am not goign to use it, also how can i mirate this hude space from vRAID0 onto my highly demand vRAID5 RSS....
Sorry i may not be very clear in my explanation , please ask me in case you require any further information... Your help is appreciated as i failed miserably to find any info on this. Please help....i think it is not possible to migrate the space from one RSS to the other , however if some one can confirm that will be great
-
Splitting file contents ....Help!!
I have a file that contain several records of the same pattern.
For example:
Name: John Mark
Adress: 2380 Blue St LA
Phone#: 8675 3099
SSN: 8999900000
Age: 2001
Name: Denis Mary
Address 5050 Red st WA
Phone# 1010 30303
SSN 000111222333
Age 8899
This file contain records of 10 or more people. I have a script that picks up this file from an ftp server. Each time I pick up this file, it comes in with a new record, or even two new records added to the
records that already exist in the file.
My job is to extract the latest records from this file, parse it, and get the social SSN of the new records.
The latest record(s) are always at the end of the file. The file name is always the same.
How can I extract the latest record(s) from this file after I pick it up from the ftp server?
I have a script that works only if the file contains just one record. Right now, when I pick up a file that contains several records, my script grabs the SSN of the record at the top. And that is wrong.
Thanks for your helpCyprayDeJava wrote:
I have a file that contain several records of the same pattern.
For example:
Name: John Mark
Adress: 2380 Blue St LA
Phone#: 8675 3099
SSN: 8999900000
Age: 2001
Name: Denis Mary
Address 5050 Red st WA
Phone# 1010 30303
SSN 000111222333
Age 8899
This file contain records of 10 or more people. I have a script that picks up this file from an ftp server. Each time I pick up this file, it comes in with a new record, or even two new records added to the
records that already exist in the file.
My job is to extract the latest records from this file, parse it, and get the social SSN of the new records.
The latest record(s) are always at the end of the file. The file name is always the same.
How can I extract the latest record(s) from this file after I pick it up from the ftp server?
I have a script that works only if the file contains just one record. Right now, when I pick up a file that contains several records, my script grabs the SSN of the record at the top. And that is wrong.
Thanks for your helpyou need to traverse to the SSN line and aquire the numeric value
I see in your input text file that you have a line seperation after each data, think how u would get to the last data
once u get to your last data go three lines down to the line containing the SSN and extract the numeric value
You can use the below method to acquire the SSN value
private static int SplitInt(String line)throws Exception{ // u should pass the scanned line to the method parameter
String array[]= line.split("\\s+"); //splits on space if my regx memory is correct
return Integer.parseInt(array[array.length-1]); // returns the numeric value which is the last element of the String array[]
} -
Split string based on number of characters
Hi,
I have a simple map where I receive a Streetname out of the source and have to write that streetname to the Address1 element in the destination. The issue is that the destination Address1 element can only contain 100 characters.
If it has more then 100 characters then I have to split the string into the Address2 element.
The next question is how I can do it the good way so that the string would be split between spaces and not in the middle of a word. For example:
Streetname1 Streetname2 Streetname3 Streetname4 Streetname5 Streetname6 Streetname7 Streetname8 Streetname9
The hundredth character is between t and r in Streetname9. So the cleanest solution would be to place everything in address1 and Streetname9 in address 2.
How can I achieve this?I had faced a similar situation in which output element could only contain 100 characters after that i had to split rest of characters in batch of 100 characters and repeated the element.
This was achieved by implementing recursion through XSLT. For this I created a template which will return a substring a generate an element with that element. This template will take two parameters-1) Complete string 2) Length (100 in your case).
check the below article for a sample
http://www.codeproject.com/Articles/16866/Recursive-XSL-Templates
Thanks,
Prashant
Please mark this post accordingly if it answers your query or is helpful. -
Splitting a String to a Character array
I need to split a string to a character array. All I can find is how to split on spaces, etc.
Can you help me?
Thanks
OzmodiarmyString = myString.toCharArray();Type mismatch! You cannot convert String myString to
char[].
Head loss - sorry, not switched on today ...
char []mychars = myString.toCharArray(); -
Splitting a string into 4 equal parts
Hi All,
I have a string with maximum no of characters as 100,
I want to split this string into 4 equal parts.
Any help will be appreciated.
RegardsHi Rajeev,
Use this sample code
class SplitString {
public static void main(String[] arguments) {
StringTokenizer ex1, ex2; // Declare StringTokenizer Objects
int count = 0;
String strOne = "one two three four five";
ex1 = new StringTokenizer(strOne); //Split on Space (default)
while (ex1.hasMoreTokens()) {
count++;
wdComponentAPI.getMessageManager().reportSuccess("Token " + count + " is" + ex1.nextToken() );
count = 0; // Reset counter
String strTwo = "item one,item two,item three,item four"; // Comma Separated
ex2 = new StringTokenizer(strTwo, ","); //Split on comma
while (ex2.hasMoreTokens()) {
count++;
wdComponentAPI.getMessageManager().reportSuccess("Token " + count + " is "+ ex2.nextToken() );
Thanks
Anup
Edited by: Anup Bharti on Oct 27, 2008 12:36 PM -
I have the following data(these are just three lines of the file that i am reading in) that I need to split up and put into an array. Its date, worker name with id number, followed by hours worked each day for the entire week.
11/03/06 John Doe 4335 40-42-40-32-40
11/03/06 Jason Doe 2233 40-2-9
11/03/06 Jane Doe 8831 12-17There are about 2-15 spaces between Data and Name and about the same between the last number of the id and the hours worked.
I need to put date, name & id, and hours into an array. How do I go about dividing up the data so that i can insert it into an array?
Any help is appreciated.If you're saying that you want
11/03/06 John Doe 4335 40-42-40-32-40to generate an array with {"11/03/06", "John Doe 4335", "40-42-40-32-40"}then you'll have to first define the rules.
You can't just split on spaces because the name/ID field contains spaces. Does that third field start in a fixed column, or a fixed number of spaces after the second field ends. Your example doesn't match either criteria.
Fixed column
11/03/06 John Doe 4335 40-42-40-32-40
11/03/06 Johnathan Doe 4335 40-42-40-32-40
OR
Fixed number of spaces follwing 2nd
11/03/06 John Doe 4335 40-42-40-32-40
11/03/06 Johnathan Doe 4335 40-42-40-32-40 -
Spliting the word at spaces in layout
Hi all,
please let me know the solution for below issue.
issue is,
i need to print the word..with spliting at spaces, here my word is
"vinesh jogu wanted the solution" But in layout
it is coming like..
"vinesh jogu want -> in one line
ed the slution-> in another line.
so , here i need the solution like
instead of spliting in between words,,,i need to split at space..
" vinesh jogu wanted " the solution.
Regards,
vinesh...4 ..uHi,
Just try with
/: protect
<ur text here>
/: endprotect.
hope this 'll work.
Thanks,
Arunprasad.P -
Increase the field width in ALV grid display
hi
My problem is that when i am trying to print data through REUSE_ALV_GRID_DISPLAY, a particular field which contain message is being truncated, i used ls_layout-colwidth_optimiser as 'X' and also t_fieldcat-outputlen = 1000, but still i am having this prblm, but i checked in the internal table that is passed in ALV, the entire data is stored there, but while printing its getting truncated for a particular field, please suggest me a solution to my problem.
Regards
SwarnaliHey Neelam
this is a very old thread, so I don t remember the exact solution which I implemented,
however can you use the i_tab name in the field TABNAME of the field catalog.
Regarding breaking the message, you can use a STRLEN if you are aware at the no. of chars where it should break always or split at space the string in 4 strings.
Inside the field catalog you have to take an internal table with 4 different fields and show it.
Hopefully it should resolve your problem.
Regards
SB -
How to count number of words in a string?
Is it only possible by counting the number of white spaces appearing in the string?
Of course that also depends upon how accurate you need to be and what the string contains. It is completely possible that there might be a line break which doesn't have a trailing or leading space.
Like that.
In that case Flash's representation of the string is likely "...space.\n\nLike that.." In chich case "space.\n\nLike" will be a word.
Also if you split on space and there are places where there are two spaces in a row you could inflate your number. So somthing that changes newlines (and returns) to spaces, then removes any multiple spaces in a row, and finally does the split/count thing would be more accurate.
But it all depends upon what you need. -
How to extract an integer or a float value from a String of characters
Hi i have a problem getting to a float value within a string of characters..
for instance the string is
"numberItem xxxxxxxxx 700.0" (each x is a space..the forum wouldnt let me put normal spaces for some reason)
how do i store 700.0 in a float variable
remember the string is obtained from an inputfile
so far i got the program to store the inputfile data line by line in a String array..i tried tokenizing the string to get to the the float value but since i have mulitple spaces within my string, the token method only gets "numberItem" from the above String
This is all i have so far:
String c;
String Array[] =new String[g]; (i used a while loop to obtain g(the nubmer of lines in the file))
while((c=(cr.readLine()))!=null)
Array[coun]=c;
it would be reallllllllllllllllllllllllllllllllllllllly easy if there was a predefined method to extract numeric values from a string in java..
Edited by: badmash on Feb 18, 2009 5:50 PM
Edited by: badmash on Feb 18, 2009 5:50 PM
Edited by: badmash on Feb 18, 2009 5:55 PMbadmash wrote:
Hi i have a problem getting to a float value within a string of characters..
for instance the string is
"numberItem xxxxxxxxx 700.0" (each x is a space..the forum wouldnt let me put normal spaces for some reason)
with the space included
how do i store 700.0 in a float variable
remember the string is obtained from an inputfile
so far i got the program to store the inputfile data line by line in a String array..i tried tokenizing the string to get to the the float value but since i have mulitple spaces within my string, the token method only gets "numberItem" from the above StringHuh?
Not true.
Anyway why not use string split, split on spaces and grab the last element (which by the format you posted would be your 700.0)
Then there is the Float.parseFloat method.
It is easy.
And another thing why not use a List of Strings if you want to store each line? (And why did you post that code which doesn't really have anything to do with your problem?) Also in future please use the code formatting tags when posting code. Select the code you are posting in the message box and click the CODE button. -
I updated to Lion os x and can't use microsoft office 2004 i can't o
I updated to Lion os x and now can not use Microsft Office 2004, I cant open it or uninstall it, it just says powerPC applications are no longer supported.
I have lost all emails on Entourage and can only retrieve emails via hostway that have been delivered today.
Trying to get help from Apple care is a nightmare as they need a serial number, which Lion being a digital download does not have one only web order number, which does not work when I put in serial box.
Can any one help me please, I am getting so frustrateddual partition just means splitting the space on your hard drive into two, having Snow Leopard on one part and Lion on the other so you could use Office '04 on the SL side. I am pretty sure installing '11 won't delete '04, but can't say with 100% certainty. You can also check out free word processing programs such as OpenOffice and LibreOffice.
-
I am writing some Text in PS file. Since the length of Text is Long it overlaps the other text beside it.
Is it possible to Wrap the Text in PS. Say for example How this text will be wrapped
/F100{/I 7.2 d I/Arial F}b F100 (Plan BB-HOME-COMBO-ULD-800-MONTHLY BI MONTHLY-1500 SIX ANNUAL PLAN-8000) 500 10 w
Regards
HarshIt's not impossible to wrap text in PostScript, but it's generally not the right way to do it. Text layout and positioning calculations should be completed before writing the PostScript.
If you are determined to do it in PostScript you can use the stringwidth operator to get the lengths of strings and decide whether they fit, then decide where to split (on spaces or punctuation is usually expected). A lot of coding. -
Server Size Need Help !!!!
Hi Experts,
Our current BW database structure is like below:
DB Size - 180,803 MB
Size Used - 180,627 MB
Free - 176 MB
Logical Files used by SQL server are,
DATA1 - Size (66,417) - Used (66,256) - Free Disk (15,014)
DATA2 - Size (55,289) - Used (55,288) - Free Disk (15,014)
DATA3 - Size (59,096) - Used (59,080) - Free Disk (15,014)
Questions:
1. How safe is the current structure? What is the next solution to reduce the risk?
2. We have an existing above BW system , Now we are implementing few more BW projects, for those different projects we will need to load huge data into this BW system. Is it best to have BW on one single server or is it best to have several smaller servers and spread the work across them? How to decide about the new Hardware sizing?
Thanks in Advance,
Sai.Hi,
Increase number of logical files.. DATA1.... DATA9
split table spaces across logical files...
for ODS and CUBES define tablesspaces... and assign those tablespaces while creating cube or ODS
Regards
Ben -
How do I place an object dynamically?
I need to place a navbar at the bottom of my Flash movie so
that it is always at the bottom regardless of screen resolution.
How would I do this???Your main problem is the use of APDivs (those are <div> tags with position:absolute set in their css). You can't center an absolute div, it's position is defined using the top, left, right or bottom css attributes. APDivs use a pixel setting for left and top to define where they go. Position:absolute is almost never needed, especially in the primary layout of a site. Skip any positioning attribute and use css margins, padding and floats instead and your site will function much more naturally between devices.
To center an element within a given space (say a standard <div> within the <body>), you can use css (with no position attribute)...
#mydiv {
width:300px; /*this needs to be a setting that is less than the width of the parent element*/
margin:0 auto; /*this splits the space left over between the element and its parent between the left and right margins*/
Then the html could be...
<body>
<div id="mydiv">Hi there</div>
</body>
With the css and html above, you will end up with a 300 pixel wide div with the words "hi there" centered on the screen within the <body> of the page.
Take some time to unlearn about the APDiv button, it's not your friend...
http://www.barelyfitz.com/screencast/html-training/css/positioning/
http://www.csstutorial.net/
CSS Tutorial
Maybe you are looking for
-
Resetting the limit on result section in Hyperion IR 9.3.1
Hi All, I am having a limit of computed item on result section which is reset with code to make this limit Ignore = "True" or "False". Report is saved as no data for result section. Now whenever i open up the report i am getting an internal error for
-
Is anyone deployed forms application to OC4J? let me know how that works
Hello Everyone, I am new to OC4J and I am trying to learn about deploying forms applications .fmx files to Oracle Application Server (OC4J). Can someone who had tried this tell me how to go about it. Please feel free to e-mail me at [email protected]
-
Is anyone happy with the new iweb 09
Is anyone happy with the new iweb 09? Do you like the new ftp option? Are there any new templates? Does this software fix any of the previous browser problems, like IE destroying our websites and effects not showing in certain browsers. I hope this i
-
Please help me i update software ios 6 and its kill my iphone
hi. im using iphone 4, 16gb yesterday i software ios 6 and its kill my cell no charging nothing just onlu logo blinks i report it at apple support center but still the same even its not charging just sign of flash coming... please help me i dnt have
-
I can't properly select text in Mavericks Mail 7.0. Any solutions?
Every time I try to place the cursor between letters to edit text in Mail 7.0, characters in another spot are edited-leading to complete gibberish that's even worse than what I'm capable of on my own. I did find some other threads here but so far no