How to Validate this String
Hi All,
I want to validate this strange String. I am not very good in REGEX, can anyone help me here.
The String is like this
AnyText [link=XXX][link]
WHere [link=XXX][link] block could be multiple times, XXX must be any number, and it could contain any text after link blocks.
Any help is highly appreciated.
Thanks
This is what I came up with
public class Test20040906
public static void main(String[] args)
String regex = "[^\\[]*(\\[link=\\d+\\][^\\[]*\\[/link\\][^\\[]*)+";
// Should pass
String target = "Some rubbish [link=123]Hello World[/link] and some [link=123]Hello World 1[/link] further rubbish";
System.out.println("Matches " + target.matches(regex));
// Should fail
target = "Some rubbish [link=123]Hello World[/link] and some [link=xxxx123]Hello World 1[/link] further rubbish";
System.out.println("Matches " + target.matches(regex));
}1) It does not use the 'reluctant' match used by yawmark.
2) It does allow for the repeats and markup text requested.
3) I does not allow '[' to be part of the markup text.
I think that an extension of yawmark's approach to deal with the markup text is probably the best.
Similar Messages
-
How to Break this String and put into a Table
Hi all,
Currently i working on the Reading of Csv file.THe Csv file wil be stored as BLOB in one table.
The Format of the Csv file is
EMPCODE :DATEOFBIRTH
312089 ,12/01/1984
321456 ,03/05/1980
120212 ,04/08/1987
312456 ,23/12/1977
311110 ,12/04/1998
323232 ,20/06/1990
UPLOAD_BLOB
column Datatype
UploadId Number
File_details BLOB
And i reading the BLOB in one procedure and i m getting the String as like this ---->
"312089 ,12/01/1984
321456 ,03/05/1980
120212 ,04/08/1987
312456 ,23/12/1977
311110 ,12/04/1998
323232 ,20/06/1990"
I am Dont know how to Parse this String and put in table
While 1<STRING.LENGTH
LOOP
EMPCODE=SUBSTRING();
DATEOFBIRTH=SUBSTRING();
INSERT INTO TABLE VALID_EMPCODE(EMPCODE,DATEOFBIRTH)VALUES(......);END LOOP
VALID_EMPCODE
EMPCODE VARCHAR2(30)
DATEOFBIRTH VARCHAR2(15)
Can any one tell me how to parse this whole string and break themDuplicate post
How to Break this String and put into a Table -
how to split this string (char1)char2(char3)char4 into (char1)char2 , (char3)char4?
String[] result = "(char1)char2(char3)char4".split("\\(");I want :
result[0] = "(char1)char2" and
result[0] = "(char3)char4"
acutally char1,char2,char3, char4 ... is in the form of the below.
(any charactors except round brace)any charactors except round brace(any charactors except round brace)any charactors except round brace
I prefer String.split and Pattern.compile().split.
Edited by: iamjhkang on Feb 5, 2009 3:37 PM
Edited by: iamjhkang on Feb 5, 2009 3:41 PMiamjhkang wrote:
especially on
?= and ?<
Thanks.The following:
(?=...) // positive look ahead
(?!...) // negative look ahead
(?<=...) // positive look behind
(?<!...) // negative look behindare all "look-arounds". See: [http://www.regular-expressions.info/lookaround.html] -
How to Validate this using Regular Expressions
Hi All,
I have following types of Mail IDs, Each is a String.
It may be either of the Following:
[email protected]
or
Ameer<[email protected]>
Then How to validate using the Regular Expressions.use this regex.. might need to convert it from perl regex flavor:
(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:
\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(
?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[
\t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\0
31]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\
](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+
(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:
(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)
?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\
r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[
\t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)
?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t]
)*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[
\t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*
)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)
*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+
|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r
\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:
\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t
]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031
]+(?:(?:(?:\r\n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z|(?=[\["()<>@,;:\\".
\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[
^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]
]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*)(?:,\s*(
?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(
?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[
\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t
])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t
])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?
:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|
\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:
[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\
]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)
?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["
()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)
?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>
@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[
\t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,
;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t]
)*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?
(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".
\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:
\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\[
"()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])
*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])
+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\
.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(
?:\r\n)?[ \t])*))*)?;\s*) -
How to validate the string object for alphabet input
Hi,
I want to check for alphabet (a-z,A-Z), in String object. I need to check the object, whether its contain numerals or special character, in that case, I want to throw an error stating that "value is not valid". It should accept only the a-z or A-Z.
how to do this.
Thanks in advance
Karthi> I want to check for alphabet (a-z,A-Z), in String
object. I need to check the object, whether its
contain numerals or special character, in that case,
I want to throw an error stating that "value is not
valid". It should accept only the a-z or A-Z.
how to do this.
As Rene suggested, you can do this using the Pattern class:
http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
You can do it also by looping through your String and check with String's charAt(index) method (which returns a char) to see if every char from the String is >= A AND <= z.
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html
Good luck. -
How to split this string into 4 sections to a max 35 characters
Hello,
Does anyone have an idea how I can acheive this please.
I have this string
Expense_Inv_8- ExpenseInv_7- Exp001- Expense_Inv_6- Expense_Inv_5- Expense_Inv_4- Expense_Inv_3- Expense_Inv_2- Expense_inv1
and I need to display them in sections seperated by ';' as explained below
Section 1 Section 2 Section 3 Section 4
Expense_Inv_8- ExpenseInv_7- Exp001;Expense_Inv_6- Expense_Inv_5;Expense_Inv_4- Expense_Inv_3;Expense_Inv_2;
need to split this string into 4 sections seperated by ';' and each section should be of no more than 35 characters, if null should end ;;;
Section 1, 35 Character ended by;
Section 2, broken off after Expense_Inv_5 because Expense_Inv_4 will take it over 35 chracters)
Section 3, should only take Expense_Inv_4- Expense_Inv_3, because adding Expense_Inv_2 will take it over 35
characters, each record in the string is seperated by '-'
Section 4, dispays the reminder of the string
regards
AdeHi,
Welcome to the forum!
Whenever you ask a question, it helps if you post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) and the results you want from that data.
I think I understand the problemk well enough to attempt a solution, but if the query below isn't right, please post that information.
WITH cntr AS
SELECT LEVEL AS n
FROM dual
CONNECT BY LEVEL <= ( SELECT MAX (LENGTH (txt))
FROM table_x
, got_best_path AS
SELECT id
, txt
, MAX ( SYS_CONNECT_BY_PATH ( TO_CHAR (c.n, '99')
) AS best_path
FROM cntr c
JOIN table_x x ON c.n <= LENGTH (x.txt)
START WITH c.n = 1
CONNECT BY c.n - PRIOR c.n BETWEEN 1
AND :section_length
AND x.id = PRIOR x.id
AND SUBSTR ( x.txt
, c.n
, 1
) = '-'
AND LEVEL <= :section_cnt
GROUP BY id
, txt
, got_pos AS
SELECT id
, REPLACE ( txt
) || ';' AS txt
, best_path
, TO_NUMBER (REGEXP_SUBSTR (best_path, '[0-9]+', 1, 2)) AS pos_2
, TO_NUMBER (REGEXP_SUBSTR (best_path, '[0-9]+', 1, 3)) AS pos_3
, TO_NUMBER (REGEXP_SUBSTR (best_path, '[0-9]+', 1, 4)) AS pos_4
FROM got_best_path
SELECT id
, SUBSTR (txt, 1 , NVL ( pos_2 , :section_length)) AS section_1
, SUBSTR (txt, pos_2 + 1, NVL ((pos_3 - pos_2), :section_length)) AS section_2
, SUBSTR (txt, pos_3 + 1, NVL ((pos_4 - pos_3), :section_length)) AS section_3
, SUBSTR (txt, pos_4 + 1, :section_length ) AS section_4
FROM got_pos
;As written, this requires SQL*Plus 9 (or higher). You can have multiple versions or SQL*Plus on the same client, if you really need to keep the older version.
:section_length is the maximum length of each section (35, as you stated the problem).
:section_cnt is the number of sections. In the query above, this is 4. If you change it, you not only have to change the bind variable, but you have to change the hard-coded SELECT clauses of the main query and the last sub-query (that is, got_pos).
MODEL or PL/SQL would probably be better ways to solve this problem. -
How to converts this string to a new character array???
I have string that get from g.getDirectory();
that string is "D:\Songs\Judas Priest"
and I want to convert to charArray[][] = {{"D",":","\","S","o","n",.....}};
how can I do it??
:'(I have ploblem again :'(
indeed I want to change string
D:\Songs\Judas Priest
to
D:/Songs/Judas Priest
I do this for upload my picture to program by directory
but when I use getDirectory();
It only save "D:\Songs\Judas Priest"
so I must change "\" to "/"
I think I must use "for" and check if it found "\" it will be change to "/"
but I don't know how to write?
public String[][] sliceNwrap(String str){
dir[0] = new String[str.length()];
for(int ndx=0;ndx<str.length();ndx++){
if(str.substring(ndx, ndx+1)=="\\"){
dir[0][ndx]= "/";
else{
dir[0][ndx] = str.substring(ndx, ndx+1);
return dir;
It still "D:\Songs\Judas Priest" :'( help me plz -
I need to insert a nvarchar type column with data like 7414;#Butler, Heather into a int type column, but only with the number before the before the character ; in the mentioned string.
In the above case only 7414 needs to be inserted into the in type column of another table. This integer value need not be restricted to 4 characters. It may be 3 or 5 characters too or anything.
Any help is appreciated....Extension of Li's sql
Try this
declare @s varchar(50)
set @s='74146;#Butler, Heather'
--set @s='74;#Butler, Heather'
Select cast(cast(substring(@s, 0, charindex(';',@s)) as CHAR(4)) as int)
--Prashanth -
How to Validate this Condition
Table Structure
1-Master_table
ct_no number(4)
rent_no number(4)
rcv_dt date2-Rcv_table
rcv_no varchar2(5)
rcv_dt date,
ct_no number(4),
rent_no number(4),Sample Data of master_table
CT_NO RENT_NO RCV_DT
2717 1 11-MAY-07
2717 2 25-MAY-07
2717 3 07-JUL-07
2717 4
2717 5
2717 6
2717 7
2717 8
2717 9
2717 10
2717 11
2717 12
2717 13
2717 14
2717 15
2717 16
2717 17
2717 18
2717 19
2717 20
2717 21I build a tabular form based on RCV_Table contain 10 Rows,in which user select ct_no and Rent_no from master_table from LOV (seperate LOV for Ct_no and Rent_no).
LOV of CT_no
select distinct ct_no from master_table
LOV of Rent_no
select rent_no from master_table where ct_no=:ct_noI want to validate..if user select 2717 in Ct_no and 4 in rent_no at first record,if user enter another record for that ct_no 2717 ,rent_no field should check the enter value should be 5.
In rent_no LOV i successfully handle that the record already been selected are not showing in LOV,but if User enter the rent_no manually without using LOV then my validation fails.
Tell me how to restrict the user to not to enter invalid value of that fieldOne IDEA!!!!!!!
you create a summary item rent_max with
summary function : max
summary block : detail bl
summary item :rent_no col of detail
So every time you have the max. rent no entered...When you enter in the next record,
if rent_no != rent_max+1, then throw error...
But One doubt ....
If ur LOV works fine ...Why dont you use Validate from list for rent no set as YES ???
Edited by: Dora on Dec 10, 2009 5:42 PM -
How to converts this string[ ][ ] to string[ ]
I have String a[ ][ ]= {{"D",":","/","S","o","n","g","s","/","J","u","d","a","s"}};
and I want to convet to
String a[ ] = {D:/Songs/Judas};
how can I do it? :((I have String a[ ][ ]= {{"D",":","/","S","o","n","g","s","/","J","u","d","a","s"}};Why do you store it as a String[][] array ?
It would be better to use a char[]
char[] a= {'D',':','/','S','o','n','g','s','/','J','u','d','a','s'};
String string = new String(a);
// or
Object[][] b = {{'D',':','/','S','o','n','g','s','/','J','u','d','a','s'}};
// I don't know why you store it in a String array but if one likes it
String[] c = new String[]{new String((char[])b[0])};To convert String[] to String one would write
String[] d={"D",":","/","S","o","n","g","s","/","J","u","d","a","s"};
StringBuffer buffer = new StringBuffer(d.length);
String e;
for ( int idx = 0; idx < d.length; ++idx) {
buffer.append(d[idx]);
e=buffer.toString(); -
How to validate numbers in char field.
Hello all,
I have one database column with char data type. This field should allow insert only
numbers [ zero to nine] and plus symbol .. how to validate this?
Pls help me..
I.m using oracle 9i database. So it does not allow REG-EXP and WITH methods.. So give some
sql coding to do thisAs this forum is for issues with the SQL Developer tool, you'll probably get more answers in the SQL And PL/SQL forum.
Regards,
K. -
How to validate the input field
Hi,
I have a input form which is draged from input port of a RFC.
in this input form i have two input fields nad submit button.
on of this input field should always take the character values only. it should not take any numeric value
and other input field should always take numeric value only.
i.e how to validate this two input fields.
regards
srinivasHi,
U can validate input fields using javascript.Write OnClientClick function for that submit button if ur using htmlb or onClick if u r using html.Refer the follows
http://help.sap.com/saphelp_nw70/helpdata/en/03/900e41a346ef6fe10000000a1550b0/frameset.htm
There are two ways to achieve ur task.
1.By checking for all alphabets.in this u need check all the alphabetic characters one by one.Refer the following
http://www.shiningstar.net/articles/articles/javascript/javascriptvalidations.asp?ID=ROLLA
http://www.shiningstar.net/articles/articles/javascript/checkNumeric.asp?ID=AW
2.By using regular expressions.its very easy and a single line code.here u need to specify single expression for whole alphabets.Refer this
http://aspzone.com/blogs/john/articles/173.aspx
Everything has been given for validating in javascript.i hope u also validating in javascript only.
For more details on "Regular expressions" search google.
Regards,
Tamil K -
How to validate selection-screen field
Hi all,
How to validate a selection-screen field defined as a select-options.for Ex i declared a selection-screen field select-options:s_matnr for mara-matnr.
Then how to validate this field.Hi,
write the below code in AT SELECTION-SCREN.
EX :
AT SELECTION-SCREEN.
*-- Validate the Selection screen data
PERFORM VALIDATE_SELSCR_DATA.
WRITE THE below code in Form "VALIDATE_SELSCR_DATA".
IF S_MATNR[] IS INITIAL.
*--MATNR is initial.
message e000(MsgCLass) with 'matnr is empty'.
ELSE.
SELECT MATNR
INTO MARA-MATNR
FROM MCHA
UP TO 1 ROWS
WHERE MATNR IN S_MATNR.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'Invalid MATNR entered'.
ENDIF.
ENDIF. -
How do count how many 'A' s in this string using sql stmt?
hi all,
i have a string like 'AAAAARAMAAAAKRISHNAAAA'.
in this ,i want to find out how many 'A's .
how do find out this using select stmt.(length(s) - nvl(length(replace(s, 'A')), 0)) / length('A')but consider (by modifying the question slightly to "how do count how many 'AA' s in this string using sql stmt? ")
SQL> select (length('AAAAARAMAAAAKRISHNAAAA') - nvl(length(replace('AAAAARAMAAAAKRISHNAAAA', 'AA')), 0)) / length('AA') x from dual
X
6
1 row selected.couldn't I argue that the result should be 10 as e.g. in
SQL> select * from xmltable('let $str := "AAAAARAMAAAAKRISHNAAAA"
let $search := "AA"
for $i in 1 to string-length($str)
where substring($str, $i, string-length($search)) = $search
return substring($str, $i, string-length($search))' columns x varchar2(10) path '.')
X
AA
AA
AA
AA
AA
AA
AA
AA
AA
AA
10 rows selected.Matter of definition I suppose .... ;)
btw. regexp_count also yields 6:
SQL> select regexp_count('AAAAARAMAAAAKRISHNAAAA', 'AA') x from dual
X
6
1 row selected. -
Converting numerous strings to one string - any ideas how to do this?
Hi,
I've written a test main class where the user inputs, via the keyboard, one integer value and four strings. I've already converted the one integer to a string value, but I now need to convert all of the strings to one string
Does anybody know how to achieve this?
Many thanks!!Thanks for the reply.
How do I change the saveTo method so it will add commas to the String filmDetails in the constructor within the class Title?
I don't understand what you mean when you say that I write to one file and read back from another. In my main class I'm only reading and writing to one file, as follows,
import simplejava.*;
import videos.*;
import java.io.*;
public class AddTitle {
public static void main(String[] args) {
String film, actor1, actor2, director, title;
int codeNum;
SimpleReader keyboard = new SimpleReader();
SimpleWriter screen = new SimpleWriter();
SimpleReader inFile = new SimpleReader("title_test.txt");
//title = inFile.readLine();
//String[] myStrings = title.split(",");
TitleList titles = new TitleList(inFile);
codeNum = keyboard.readInt("Title Code for the Film");
int intValue = codeNum;
String stringValue = Integer.toString(intValue);
film = keyboard.readLine("Film Title?");
actor1 = keyboard.readLine("Lead Actor?");
actor2 = keyboard.readLine("Supporting Actor?");
director = keyboard.readLine("Director?");
String videoTitles = film+actor1+actor2+director;
titles.add(new Title(codeNum, videoTitles));
screen.println(titles);
SimpleWriter outFile = new SimpleWriter("title_test.txt");
titles.saveTo(outFile);
outFile.close();
}In the main class I thought I was closing the file with the code,
outFile.close();Any ideas how to solve these problems?
Maybe you are looking for
-
Why Actual is 0 in the report S_ALR_87013558?
Dear experts, i have issure IR with transaction code MIRO, but when i run S_ALR_87013558 ,the actual is 0,can you tell me how to check? Best Regards, Merry
-
Are roles in SXMS_CONF_ITEMS and SLD consistent?
hello! i installed and configured my new XI system. when i go in Runtime Workbench (via browser) i see an error in result of Integration Engine monitor . "Are roles in SXMS_CONF_ITEMS and SLD consistent?" i check all in SLD and i think is ok. have y
-
Can one control image size? My iMac has a 17" monitor and occasionally a web image presents as way too big -- just a part is shown, with slide controls offered below and to the right. Any way to reduce the image to fit the monitor?
-
Load music now or wait until new computer arrives?
Hi! I just recieved a ipod nano and while in the process of loading my cd's I decided to purchase a new computer...should I hold off putting the cd's in the computer until I have my new computer or is transferring stuff pretty easy between computers
-
Installed iWork '08. Pages and Numbers launch; Keynote will not. I have reinstalled, and updated. It is not a faulty DVD. Any thoughts?