sql - Using SUBSTR() AND INSTR() find end of string -


i have problem, select substring string. string after equal. example looks one.

string='test = 1234sg654' 

my idea select string after equal "1234sg654", in way: instr() find position of equal, after substr(), subtract string after equal until end of string.

equal=instr(string,'=',1,1); aux=substr(string,-1,equal); // -1 thought represent end of line 

but result not 1234sg654 mistake?

don't use -1 position argument -- substring starts many characters end of string. can do:

aux = substr(string, instr(string, '=') + 1) 

no third argument means "go end of string".


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -