Split string in PLSQL - plsql

Following should return Y
CASISA#Y
INVOPT#LUMREG#LUMSUM#2000#REGSUM#8000
LUMSUM#2000#REGSUM#8000
i.e Hash separates Code and Value and it also separates Code, Value pairs (earlier semicolon used to separate Code, Value pairs)
Following should return N (as these are incorrect input string formats)
CASISA#
INVOPT#LUMREG#LUMSUM
LUMSUM#2000#REGSUM#8000#

case when regexp_like(your_string||'#', '^(\w+#\w+#)+$') then 'Y' else 'N' end
SQL Fiddle

Related

given string containing sum - add parentheses where they are needed

I'm looking for an algorithm to take a string displaying a sum and add the relevant parentheses where required. For example:
Given: 1+2*3=7 it would return 1+(2*3)=7
Given: 5*2+10/5-4=8 it would return (5*2)+(10/5)-4=8

Create correct Criteria Operator

Trying to create a Criteria.Parse operator when I have to convert the string field to an Int.
Operation fails at the follwing:
Message=Parser error at line 0, character 15: syntax error;
("Convert.ToInt16{FAILED HERE}(awayML)>130")
Here is my code:
XPCollection collection = new XPCollection(session1, typeof(TodaysGame), CriteriaOperator.Parse("Convert.ToInt16(awayML)>130"));
int ct = collection.Count;
How do I form the Criteria using the Convert.ToInt16 function?
Criteria operators have their own syntax to convert string literals to int values. You need to use them instead of system Convert.ToInt function:
Function
Description
Example
ToInt(Value)
Converts Value to an equivalent 32-bit signed integer.
ToInt([Value])
ToLong(Value)
Converts Value to an equivalent 64-bit signed integer.
ToLong([Value])
You can check the full reference of DevExpress criteria syntax here
The correct way to build a Criteria like that would be:
CriteriaOperator.Parse("ToInt([awayML]) > 130");

How to make a pattern that uses the formula and the value of the same cell in Google Sheets?

I want to create a model where I can add numbers to that specific column and it will return a string concatenating a string and the value put in the cell.
Example:
When writing a value 123 to the cell, it will return a string say "http:// www.link.com/" concatenated with the value of the value 123 (as string).
Resulting -> http:// www.link.com/123
Use the operand &
For example, use this formula the result cell:
="http:// ww.link.com/"&A1
It will use A1 cell value to concatenate to your string

Accessing elements of a map when using a variable key in Groovy

I'm trying to replace some characters in a String From a map
Case 1
​map= ['O':'0', 'L':'1', 'Z':'2', 'E':'3']
"Hey".toUpperCase().toCharArray().each{
print map.get(it,it)
}
The result is
HEY
Case 2 : I dont use toCharArray()
"Hey".toUpperCase().each{
print map.get(it,it)
}
The result is like expected
H3Y
So I tried several alternatives when using toCharArray(), and the only way to access the value is to use map."$it"
Why i can only use map."$it" to access my map when using toCharArray() ?
Because you are trying to get a value from a map using a char whilst every key there are String, and they are not equals:
assert !'E'.equals('E' as char)
$it works because it is converted to String:
e = 'E' as char
assert "$e".toString().equals('E')
(Note the toString() is needed, otherwise the comparison will happen between String and GStringImpl which are not equals)

How to split strings from a line in robot framework

How to get rest of the values from the variable
${random employee}= Convert To String ${random emp}
${replace}= Remove String Using Regexp ${random employee} ['\\[\\]\\,]
${splitline}= Fetch From Left ${replace} ${SPACE}
Output:
${replace} Alagu kartest1234+3alagu#gmail.cokartest1234+3ramu#gmail.com Developer Team B3 Team lead
${splitline} = Alagu
How to get rest of the values from the variable ${replace}
Keyword Split String from String standard library does this.
Split String string, separator=None, max_split=-1
Splits the string using separator as a delimiter string.
If a separator is not given, any whitespace string is a separator. In that case also possible consecutive whitespace as well as leading and trailing whitespace is ignored.
Split words are returned as a list. If the optional max_split is given, at most max_split splits are done, and the returned list will have maximum max_split + 1 elements.
Examples:
#{words} = Split String ${string}
#{words} = Split String ${string} ,${SPACE}
To get single values from #{words} use common array syntax: #{NAME}[i]. i is the index of the selected value. Indexes start from zero.

Resources