Display each words of the string in separate line.
Dear Javaties,
pls help me creating this program.
Display each words of the string in separate line.
Eg.
Input value : Testing this string.
Output : Testing
this
string
Thanks in adavance,
M. Suresh
M Suresh,
We would be delighted to help if only you asked a specific question. Do my work for me is not a specific question.
The Javaties
Similar Messages
-
How to send really Chinese word, not the string "&# number " to web browser
Each Chinese word on page sending to web browser is translated to a string in form "&#<number>" by default, it's a problem when Chinese word is included in url. How to specify sending really Chinese word, not the string "&#<number>" to web browser?
Thanks that seems to make much more sense, still having some troubles though.
Ok so now the majority of it seems to be working and it seems to be sending the String just fine. And I'm having it send the String to the BufferedWriter "out" and then using the newLine() method to send a carriage return but the BufferedReader on "in" seems to not detect the carriage return.
I have it doing a readLine() so that (as I understand it) it should be blocking, waiting until an end of line character so I assume each call of newLine() should have it pick up something but a quick breakpoint shows that it never stops blocking on readLine().
I assume the connection is fine because the application running as server uses the socket object returned by the accept() method.
Is there something I've perhaps misunderstood about the BufferedReader's readLine() method?
Here's the new version of my netbeans project:
http://rapidshare.com/files/371224512/KerazehDood.rar
Also on a different line of questioning, I'm just wondering about socket convention.
I was thinking it'd be useful in a game similar to what I'm attempting to make to not only send player position information but also client keypress information, I was just wondering, if you're doing something like that would it be frowned upon to use two separate ports? I think it would make the implementation far more legible and easy to structure but wasn't sure if applications usually try to stick to only one port or not.
Thanks.
Edited by: ThePermster on Apr 2, 2010 10:54 AM -
To get Length of each word in a String.
Hi,
I wanted to know, how to calculate the length of each word in a string.Suppose for example if the input is like this:
i/p:'Tech on the Net'
o/p:4 2 3 3
ie Tech-4 on-2 the-3 Net-3
another Ex:i am a good boy
o/p:1 2 1 4 3
Kindly let me know any PL/SQL function or SQL query which would help to achieve this.
Thanks&Regards
Zaheersql>select substr('tech on the net',decode(n,0,1,instr('tech on the net',' ',1,n)+1),
decode(instr('tech on the net',' ',1,n+1),0,length('tech on the net')-instr('tech on the net',' ',1,n),
instr('tech on the net',' ',1,n+1)- decode(n,0,0,instr('tech on the net',' ',1,n))-1)) wrd,
length(substr('tech on the net',decode(n,0,1,instr('tech on the net',' ',1,n)+1),
decode(instr('tech on the net',' ',1,n+1),0,length('tech on the net')-instr('tech on the net',' ',1,n),
instr('tech on the net',' ',1,n+1)- decode(n,0,0,instr('tech on the net',' ',1,n))-1))) cnt
from(select rownum-1 n
from dual
connect by level <= length('tech on the net') - length(replace('tech on the net',' ',''))+1)
WRD CNT
tech 4
on 2
the 3
net 3 -
How to display a string in separate line in a jsf page?
Hi,
my view bean returns a string say, " Java Server Faces" .I just want to display all the three in a separate line like
Java
Server
Faces
If i go for concatenation or append method it is displaying in a way as before in java console.But when i display the same in a JSF page it is displayed as a single word.Can anyone help me in this?
Thanks in Advance.
Edited by: Swetha_Swetha on Feb 12, 2008 10:34 PMya if we are passing three separate string values means we can use
But am passing a single string value but appended as "Java"+"\n"+"Server"+"\n"+"Faces".
In JSF page am just calling the method so, it should return the values in 3 separate lines.
Thanks in Advance. -
Display multiple choice column selections on a separate line in the body of email
This question could have been answered elsewhere and I just don't realize it. I have a SharePoint Foundation 2010 form (11 columns) that has one choice column allowing the user to select multiple options (checkboxes). The selections have been typed into "type each choice on a separate line". Moving to Designer we have created a workflow that sends an email when the user submits to form.
If Current Item: Select shift equals DAY request Email ................
The body of the email has this field:
Information Being Requested: [%Current Item: The following information is being requested%].
When the user gets the email the output for this field is string on a single line separated by a comma. What I need is each of the selections to be on a separate line so the users can easily read what is being requested and not miss any of the selection. I'm stuck. I'm not worried about text wrapping. I've been searching for hours but either it's not what a need, it's over my head, or I just don't know where to make the changes. I don't use VS but I do know html and I'm fairly comfortable in Designer. I would appreciate any help.Firstly, can you edit your post and take the question out of the code / quote box. It'll make it easier to read.
Secondly the options depend on the version of SharePoint. Are we to assume you're using SharePoint 2003 or 2007 as you've posted into the legacy forums?
Steven Andrews
SharePoint Business Analyst: LiveNation Entertainment
Blog: baron72.wordpress.com
Twitter: Follow @backpackerd00d
My Wiki Articles:
CodePlex Corner Series
Please remember to mark your question as "answered" if this solves (or helps) your problem. -
Pls help me to count the no of occurence of each word in the data file
I want to count the no of occurence of each word the data file..
anybody help me out to solve this ,,
I have attached my code hereby...
import java.io.*;
import java.util.*;
import java.util.Collections;
import javax.print.attribute.standard.Media;
class WordCounter1 {
String s;
String word;
public static void main (String[] args){
WordCounter1 simpleCounter= new WordCounter1();
try
File firstFile=new File("C:/Documents and Settings/janmala/file4.txt");
simpleCounter.countWords(firstFile);
catch(Exception e)
System.err.println(e);
void countWords(File inputFile)
int count=0;
int key=0;
LinkedHashMap lhm=new LinkedHashMap();
try{
FileInputStream fin=new FileInputStream(inputFile);
DataInputStream din=new DataInputStream(fin);
while(din.available()!=0){
s=din.readLine();
StringTokenizer st=new StringTokenizer(s);
while(st.hasMoreTokens())
word=st.nextToken();
lhm.put(word,count);
if(lhm.containsKey(word))
lhm.get(word);
count++;
System.out.println(word);
System.out.println(count);
int a=lhm.size();
System.out.println("The size of Hash map"+a);
Set set = lhm.entrySet();
Iterator it = set.iterator();
while(it.hasNext())
Map.Entry me = (Map.Entry)it.next();
System.out.println(me.getValue()+":"+me.getKey());
catch(Exception e)
System.err.println(e);
}}jan07 wrote:
anybody help me out to solve this ,,Solve what?
Don't just dump a pile of unformatted code and expect someone to magically fix it for you.
Post code, hightlight it and click the CODE button to retain formatting
Include error messages if you get them
Ask an actual question -
Display only part of the STRING field, but search ALL field
Hi all,
I have a field VARCHAR2(4000) that holds a lot of text.
When I make a report in APEX, it shows in each row, ALL text, so the report is very "ugly".
I want to limit the display of that column for only the first 60 characters.
I tried to use the SUBSTR function, that worked, but the search option will search for the text only in that 60 lenght characters, and will now search in the rest (not displayed) part of the field.
Is there a way to do this full search and display only part of the field?
ThanksYou can have the 'substring' column displayed to the user, but have another column which shows the full text lets say it has an ALIAS of "*SEARCH_LARGE_TEXT*" in the report definition(and is among the displayed columns).
You can hide the large text column(SEARCH_LARGE_TEXT) using JS as
$('th[id="SEARCH_LARGE_TEXT"],TD[headers^="SEARCH_LARGE_TEXT"]').hide()
Note: ^= syntax used to match data column even when break formatting used
You can make sure that the column stays hidden even after an IR filter or refresh by binding it to the refresh event of the IR by
$('#apexir_WORKSHEET_REGION').bind('apexafterrefresh', function(){
$('th[id="SEARCH_LARGE_TEXT"],TD[headers^="SEARCH_LARGE_TEXT"]').hide()
change the string "SEARCH_LARGE_TEXT" with your column's alias
Hope it helps -
To validate each part of the string
Hi,
In one string, we have these
ID_A,ID_B,ID_C, ..., ...
I know that there's a way in PL/SQL to divide it into several parts and each part is for one ID. But can I expect that to divide the string into several parts, and then to store all IDs in something like an Array, in PL/SQL? Is this possible, though I know there's no array field type in PL/SQL?
Regards,
huaminxtender wrote:
You can use my package xt_regexp - http://github.com/xtender/XT_REGEXP
To install execute in this order: types.sql, xt_regexp.jsp, xt_regexp.pck
Example:
with t as (
select 'ID_A,ID_B,ID_C,' str from dual
union all
select 'ID_A,ID_B,ID_C,ID_D' str from dual
select
t.*,
row_number() over (partition by t.str order by t.str) substr_number,
substring.column_value substring
from t,
table(xt_regexp.split(t.str,',')) substring
That's nice, but you may want to benchmark that against an approach that doesn't make a bunch of external calls (for performance)...
with t as
select 1 as id,'ID_A,ID_B,ID_C' str from dual
union all
select 2 as id, 'ID_A,ID_B,ID_C,ID_D' str from dual
select
t.*,
regexp_substr (t.str, '[^,]+', 1, s.column_value) as split
from
t,
table( cast (multiset (select level from dual connect by level <= length(regexp_replace(t.str, '[^,]+')) + 1) as sys.odcinumberlist)) s
ID STR SPLIT
1 ID_A,ID_B,ID_C ID_A
1 ID_A,ID_B,ID_C ID_B
1 ID_A,ID_B,ID_C ID_C
2 ID_A,ID_B,ID_C,ID_D ID_A
2 ID_A,ID_B,ID_C,ID_D ID_B
2 ID_A,ID_B,ID_C,ID_D ID_C
2 ID_A,ID_B,ID_C,ID_D ID_D
7 rows selected.
Elapsed: 00:00:00.02
TUBBY_TUBBZ?For example. -
TextFiled Autocompletion, how can i implemen it for each word in the swing
Dear friends,
I am looking out for the code of textfield autocompletion in swing which will be applied for each word.Dear friends,
I am looking out for the code of textfield autocompletion in swing which will be applied for each word. -
Is it possible to add a word at the end of a line?
Hi, i'm searching a way to automatically add a word at the end of a certain paragraph styles?
is it something possible doing by using a script?
i don't script myself but if someone could find me a way to do this it would be really appreciated.
Here's an example to what i need to do:
i have paragraph style X in a current book document, and i need to edit the book and add the copyright source at the end of every line that has the style X to it
so i would need something that asks me
the targeted paragraph style
which word i want to append to it, and then apply it torough the document.
Thanks in advanceYes, the screen shot shows where you got it wrong:
function(){return A.apply(null,[this].concat($A(arguments)))}
Find: (.)$
and set your paragraph style in the find format area
Change: $1XYZ
where XYZ is the text you want to insert.
.. you forgot the '1' right after the '$'. It's an important omission: "$1" is a GREP code, meaning "insert the found text, parenthesized group #1" -- and there is also a "$2", "$3", etc. up to "$9". It's great if you have to switch two, or even more, items around! But without the digit, the dollar sign indicates ... just a dollar sign.
Change the Change to text to
$1~S(CEMEQ)
and you'll be fine. -
Selecting words in the beginning of a LINE (not a paragraph)
Hi
I'm trying to avoid certain combinations to fall at the beginning of any line in a body text.
How do I select a particular character only if it occurs in the beginning of a line (but in the middle of a paragraph.
For instance I want to select the char "a" only if it occurs at the left margin of a column
I only find the location marc "beginning of a paragraph" (^), or beginning of a word, but not the beginning of a line.
It could be as grep, or as a script.
Anybody?
Thank you
/javierIt would need a script. GREP is not aware of the individual lines in a paragraph.
The good news is, InDesign's scripting language is fully aware of lines. There are, on first sight, two possible ways of locating all a's at the start of a line. Either search for all a's (doesn't need a GREP, but you must remember to set caseSensitive in the FindChangePreferences) and loop over them, checking for the ones that are at the start of a line, or check all lines one by one, checking for the ones that start with an 'a'.
Both options seem equally slow I guess what to use depends on your text, and what you'd want to do when one is found. On that note: you must process them from last found to first, because if you change something, it may have an effect on all text that follows. -
How to read each and every word from a string.
Hi all,
I have a string which is having many label numbers. if the string is lv_str, its value is like, 11111111111111##22222222222222##3333333333333.
I need to move the values alone into internal table. each value should be updated as a single row into one internal table. How to read each and every word of the string and move to an internal table.
the internal table should be like this.
11111111111111
22222222222222
3333333333333
Can any one give me a suggestion in this regard.
POINTS PROMISED.
Regards,
BuvanaHi,
If you know the format and length of the data
Use split at '#' so that you will get the individual values.
Thean append it to internal table.
Reward iof helpful. -
Here's how to find the right word in a string
I needed to find the rightmost word in a string. I didn't find a simple formula in these forums, but I now have one, so I wanted to share it. Hope you find it useful.
Assuming that the string is in cell A1, the following will return the rightmost word in the string:
RIGHT(A1,LEN(A1)-FIND("*",SUBSTITUTE(A1," ","*",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))I found the problem. Whatever character was being used in the substitution was parsed out by the forum parser. I replaced it with "œ" (option q on my keyboard).
=RIGHT(A1,LEN(A1)-FIND("œ",SUBSTITUTE(A1," ","œ",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))
Still needs an error check for a single-word "sentence" and to remove the trailing period but it does seem to work. Pretty slick.
Message was edited by: Badunit
I see below that the problem was fixed by the OP.
Message was edited by: Badunit -
Match Certain word in a String
Hi all,
I'm actually doing a project regrading e-learning. And i'm suppose to create a set of questions for each topics using labview. So Is there any way that i can match certain word in the string to make sure that answer is correct? Cause i'm sure that every user that input answer will be different. Thus, I want to pick out main point as an answer. Is there anyway i can do it??
Really appreciate your help!!!
Thank you!!
Solved!
Go to Solution.
Attachments:
Match Strings.vi 8 KB
Match Strings.vi 8 KBHere's another option (building on Jeff's code). Turn on the Conditional Terminal on the FOR loop and change it to "Continue if TRUE". This way, the loop will exit as soon as a failure is found. Just pass the result straight out of the loop. If none fail, then the FOR loop will exit on its own (from the auto-indexing) and a pass is passed out.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Attachments:
Match String.png 19 KB -
Replace complete words by another string
Hi,
I'm searching for a possibility to replace complete words inside a string.
For example I want to replace "quick" by "slow":
"The <b>quick</b> brown fox is running quicker then the slow brown fox".
The result shall be:
"The <b>slow</b> brown fox is running quicker then the slow brown fox".
The problem is, that the built in "Replace"-Method would also replace "quicker" by "browner".
Furthermore, words beetween different signs (e.g. , . ; : - ! " ? ') shall also be found as complete word.
I already searched for a FM but didn't find anything. Regular expressesions are also not possible because we are running on 6.40.
Maybe anybody can help me with a simple FM or something else.
Best regards,
StefanHi Stefan,
There is a crude way of doing this....with lots of loops..
You can use the SPLIT statement
SPLIT dobj AT sep INTO
{ {result1 result2 ...} | {TABLE result_tab} }
[IN {CHARACTER|BYTE} MODE].
and break the sentence into words using space as delimiter. Once you have all the words in a internal table, you can loop through it and compare each word with the word you want.
This will solve the problem, but will not be performant enough.
Regards,
Vinodh
Maybe you are looking for
-
Downloaded Firefox to the desktop. When installing while not on the internet and the installation crashed. A window asked us to go onto the internet. We did and clicked the Firefox download button. When running the program, it crashed again.
-
I rented a movie and the download fails repeatedly - Error = -50
I tried to rent a movie on iTunes and the download fails after pulling down 420.1MB of 1.6GB, The code I get is Error = -50. Any suggestions? I have already been billed for this event though it has not fully downloaded.
-
ITunes 11 for Mac "Update All Apps" grayed out, requiring relaunch to update again
On iTunes 11.2.1 (1) "Update All Apps" grays out after I update once. I need to relaunch iTunes to get it to be clickable again. I am definitely logged in, etc., so it seems like a bug with iTunes, yes?
-
No sound when I try to use headphones
I can view a movie on my Ipad and listen to the sound. I plug in a pair of headphones and the sound stops. I can no longer hear it on my Ipad or through the headphones.
-
HT6074 How can I watch flash Videos with the ipad with safari?
I Have an iPad an I'll watch flash Videos with this. But there is no Flashplayer. Is there any Plugin?