Sub string function

I tried to search and nothing came up. Just to confirm, is there a
sub-string function available in ODK?

/r
Nik

On the opendatakit.org help pages
http://opendatakit.org/help/form-design/binding/ , there is a link to the
source code for the functions available in ODK (Javarosa)
https://bitbucket.org/javarosa/javarosa/src/tip/core/src/org/javarosa/xpath/expr/XPathFuncExpr.java#cl-128

That source code shows that there are "substr(str,startindex)" and
"substr(str,startindex,endindex)" functions defined.

These functions index into the string at position 0, so substr(str, 0) is
equal to str.
Negative indicies can be used for startindex and endindex, in which case
they are interpreted as starting from the end of the string.

"string-length(str)" may be a useful function to obtain the length of a
string.

"concat(str1, str2, ...)" will concatenate two or more strings together.

Mitch

··· On Sun, Jul 8, 2012 at 3:55 AM, ゴー・ニコライ wrote:

I tried to search and nothing came up. Just to confirm, is there a
sub-string function available in ODK?

/r
Nik

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

Thank you Mitch for the info and the link.

/r
Nik

··· On Monday, July 9, 2012, Mitch S wrote:

On the opendatakit.org help pages
http://opendatakit.org/help/form-design/binding/ , there is a link to the
source code for the functions available in ODK (Javarosa)
https://bitbucket.org/javarosa/javarosa/src/tip/core/src/org/javarosa/xpath/expr/XPathFuncExpr.java#cl-128

That source code shows that there are "substr(str,startindex)" and
"substr(str,startindex,endindex)" functions defined.

These functions index into the string at position 0, so substr(str, 0) is
equal to str.
Negative indicies can be used for startindex and endindex, in which case
they are interpreted as starting from the end of the string.

"string-length(str)" may be a useful function to obtain the length of a
string.

"concat(str1, str2, ...)" will concatenate two or more strings together.

Mitch

On Sun, Jul 8, 2012 at 3:55 AM, ゴー・ニコライ <nikolai.go@gmail.com<javascript:_e({}, 'cvml', 'nikolai.go@gmail.com');> wrote:

I tried to search and nothing came up. Just to confirm, is there a
sub-string function available in ODK?

/r
Nik

--
Post: opendatakit@googlegroups.com <javascript:_e({}, 'cvml',
'opendatakit@googlegroups.com');>
Unsubscribe: opendatakit+unsubscribe@googlegroups.com <javascript:_e({},
'cvml', 'opendatakit%2Bunsubscribe@googlegroups.com');>
Options: http://groups.google.com/group/opendatakit?hl=en

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com <javascript:_e({}, 'cvml',
'mitchellsundt@gmail.com');>

--
Post: opendatakit@googlegroups.com <javascript:_e({}, 'cvml',
'opendatakit@googlegroups.com');>
Unsubscribe: opendatakit+unsubscribe@googlegroups.com <javascript:_e({},
'cvml', 'opendatakit%2Bunsubscribe@googlegroups.com');>
Options: http://groups.google.com/group/opendatakit?hl=en