Post

2 followers Follow
0
Avatar

How can I Split a string in Calc field?

I want to split a string, where I want to remove the number before the string. 
Ex: 1.Access Stock Pull WorkSheet

Ex. 22.Complete Date (Post POP)

Above is the string example where I want to remove the number before ".". So the final string I want something like below. 
Ans. Access Stock Pull WorkSheet

Ans. Complete Date (Post POP)

Anup Kumar Dhal

Please sign in to leave a comment.

3 comments

0
Avatar

Hi ,

you have some options, for example:

var text = "Ex: 1.Access Stock Pull WorkSheet";
"Ans. " + text.substr(text.lastIndexOf(".") + 1)

or

"Ans. " + text.split(/\d\./)[1]

or

text.replace(/^.*?\.([A-Z])/,"Ans. $1")

Option 1 looks for the of last occurence of a dot and gets the substring after dot +1 character (that's the dot) 
Option 2 splits the texts after a number followed by a dot and gets the second part.
Option 3 replaces everthing from the beginning of the text till the first dot followed by a capital letter with "Ans. ".

Rainer

Rainer Grabowski 0 votes
0
Avatar

Hi Rainer,

You have mistaken me I mean to say My string is like:

Strings:

1.Access Stock Pull WorkSheet

56.Complete Date (Post POP)

The answers I want is like:

Answers:

Access Stock Pull WorkSheet

Complete Date (Post POP)

 

Can you please give a solution as I have mentioned.

Thanks,

Anup Kumar Dhal

Anup Kumar Dhal 0 votes