Ask Question Forum:
Model Library:2025-02-08 Updated:A.I. model is online for auto reply question page
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by dravidnsr
at 2024-07-24 01:27:34
Point:500 Replies:9 POST_ID:829087USER_ID:11987
Topic:
Java Programming Language;;J2EE
Hi i have ah string like this
String s = add(add(12,5),5)
I want to split this first i want to do inside add then come to out side
String s = add(add(12,5),5)
I want to split this first i want to do inside add then come to out side
Expert: awking00 replied at 2024-07-25 12:37:18
I suspect your example is a sample representation of some real data that probably has more than one variation. Perhaps you can provide some different samples and, most importantly, an explicit explanation of the criteria to employ to produce your desired results.
Expert: rrz replied at 2024-07-24 08:52:27
If you want
add(add(12,5),5) to change to No((no(12)+no(5))+no(5))
add(add(12,5),5) to change to No((no(12)+no(5))+no(5))
import java.util.regex.*;public class Test { public static void main(String args[]){ String s = "add(add(12,5),5)"; Pattern p = Pattern.compile("-?\d+"); Matcher m = p.matcher(s); StringBuilder sb = new StringBuilder("No(("); while (m.find()) { sb.append("no(" + m.group() + ")+"); } sb.deleteCharAt(sb.length() - 1); sb.append(")"); System.out.print(sb.toString()); }} 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:
Expert: CEHJ replied at 2024-07-24 05:25:47
Sorry - no. I have no experience with it personally
Author: dravidnsr replied at 2024-07-24 04:00:46
Chj can you tell how implement in my example string
Expert: CEHJ replied at 2024-07-24 02:37:06
Author: dravidnsr replied at 2024-07-24 02:18:31
Praser?? Can you give some example?
Expert: CEHJ replied at 2024-07-24 01:43:02
You can't really handle nesting well with regular expressions. What you're doing is dealing with a mini-language so you need to create a parser for it
Expert: duncanb7 replied at 2024-07-24 01:36:17
Why you mention split string ? If using split() to split string with delimiter
of "-",for example, the code will be this
of "-",for example, the code will be this
String string = "004-034556";String[] parts = string.split("-");String part1 = parts[0]; // 004String part2 = parts[1]; // 0 1:2:3:4:
Could you write it more and in detail
Duncan
Author: dravidnsr replied at 2024-07-24 01:34:13
I want yo change that into
No((no(12)+no(5))+no(5)) how do this
No((no(12)+no(5))+no(5)) how do this