There are three kinds of actuaries: those who can count, and those who can't.
Ramesh-X
Ramesh Pramuditha Rathnayake wrote:if you want "PT3, PT6...., PT10, PT11,..." I think regex is the best..!!
Gabriel Beres wrote:
Ramesh Pramuditha Rathnayake wrote:if you want "PT3, PT6...., PT10, PT11,..." I think regex is the best..!!
What would be the pattern for that?
There are three kinds of actuaries: those who can count, and those who can't.
Campbell Ritchie wrote:You need to explain exactly what you want from the String. Do you want to divide it into three‑character parts? Do you want to divide when a digit is followed by a letter?...
Ramesh-X
Gabriel Beres wrote:None of these patterns actually work
Jeff Verdegan wrote:
Gabriel Beres wrote:None of these patterns actually work
That's not surprising, considering you still haven't told us your exact rules.
Also note that ItDoesntWorkIsUseless(⇐click).
I would like to make an array from the following string in java:
PT3PT6PT7PT8PT9PT10PT11PT13PT14PT15PT16PT17PT19PT20ST6ST7
like
0 = PT3
1 = PT6
2 = PT7
...
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
fred rosenberger wrote:can you better define "a number"?
is -1 possible?
how about 2.839?
how about e or i?
how about 1.189 * 10^14?
all of the above are valid numbers in various situations.
Gabriel Beres wrote:
Jeff Verdegan wrote:
Gabriel Beres wrote:None of these patterns actually work
That's not surprising, considering you still haven't told us your exact rules.
Also note that ItDoesntWorkIsUseless(⇐click).
I would like to make an array from the following string in java:
PT3PT6PT7PT8PT9PT10PT11PT13PT14PT15PT16PT17PT19PT20ST6ST7
like
0 = PT3
1 = PT6
2 = PT7
...
That's it. two letters like PT, and a number after
Mike Simmons wrote: split() you need a regex for the delimiter, not the content between the delimiter. Instead, the regexes given are designed to be used with a Matcher, where you find() each new element
Ramesh-X
Mike Simmons wrote:The patterns given previously probably do work, but not in a split(). That's because in split() you need a regex for the delimiter, not the content between the delimiter. Instead, the regexes given are designed to be used with a Matcher, where you find() each new element. But to do it with split() , you could define a regex that uses lookahead and lookbehind, to find a location in the string that's after a number and before a letter:
Consider Paul's rocket mass heater. |