source: trunk/docs/api/zoo-string.txt @ 817

Last change on this file since 817 was 348, checked in by neteler, 13 years ago

set correctly svn propset

  • Property svn:eol-style set to native
  • Property svn:keywords set to HeadURL Date Author Id Rev
  • Property svn:mime-type set to text/plain
File size: 3.0 KB
Line 
1.. _api-zoo-string:
2
3ZOO.String
4==========
5
6Contains convenience methods for string manipulation:
7
8Functions and Properties
9------------------------
10
11.. list-table::
12   :widths: 30 50
13   :header-rows: 1
14
15   * - NAME
16     - DESCRIPTION
17   * - :ref:`startsWith <startsWith>`
18     - Test whether a string starts with another string.
19   * - :ref:`contains <contains>`
20     - Test whether a string contains another string. 
21   * - :ref:`trim <trim>`
22     - Removes leading and trailing whitespace characters from a string.
23   * - :ref:`camelize <camelize>`
24     - Camel-case a hyphenated string.   
25   * - :ref:`tokenRegEx <tokenRegEx>`
26     - Used to find tokens in a string.     
27   * - :ref:`numberRegEx <numberRegEx>`
28     - Used to test strings as numbers.
29   * - :ref:`isNumeric <isNumeric>`
30     - Determine whether a string contains only a numeric value.
31   * - :ref:`numericIf <numericIf>`
32     - Converts a string that appears to be a numeric value into a number.       
33
34.. _startsWith:
35
36startsWith
37  ::
38 
39    startsWith: function(str,sub)
40
41  Test whether a string starts with another string.
42
43  *Parameters*
44 
45  | ``str {String}`` The string to test.
46  | ``sub {Sring}`` The substring to look for.
47
48  *Returns*
49
50  ``{Boolean}`` The first string starts with the second.
51 
52.. _contains:
53
54contains       
55  ::
56 
57    contains: function(str,sub)
58
59  Test whether a string contains another string.
60
61  *Parameters*
62 
63  | ``str {String}`` The string to test.
64  | ``sub {String}`` The substring to look for.
65
66  *Returns*
67
68  ``{Boolean}`` The first string contains the second.
69 
70.. _trim:
71
72trim   
73  ::
74 
75    trim: function(str)
76
77  Removes leading and trailing whitespace characters from a string.
78
79  *Parameters*
80 
81  ``str {String}`` The (potentially) space-padded string. This string is not modified.
82
83  *Returns*
84
85  ``{String}`` A trimmed version of the string with all leading and trailing spaces removed.
86
87.. _camelize:
88
89camelize       
90  ::
91 
92    camelize: function(str)
93
94  Camel-case a hyphenated string. Ex. "chicken-head" becomes "chickenHead", and "-chicken-head" becomes "ChickenHead".
95
96  *Parameters*
97 
98  ``str {String}`` The string to be camelized.  The original is not modified.
99
100  *Returns*
101
102  ``{String}`` The string, camelized 
103 
104.. _tokenRegEx: 
105 
106tokenRegEx     
107  Used to find tokens in a string.  Examples: *${a}, ${a.b.c}, ${a-b}, ${5}*
108 
109.. _numberRegEx:   
110 
111numberRegEx     
112  Used to test strings as numbers.
113 
114.. _isNumeric: 
115 
116isNumeric       
117  ::
118 
119    isNumeric: function(value)
120
121  Determine whether a string contains only a numeric value.
122
123  *Examples*
124
125  ::
126 
127    ZOO.String.isNumeric("6.02e23") // true
128    ZOO.String.isNumeric("12 dozen") // false
129    ZOO.String.isNumeric("4") // true
130    ZOO.String.isNumeric(" 4 ") // false
131
132  *Returns*
133
134  ``{Boolean}`` String contains only a number.
135 
136.. _numericIf: 
137
138numericIf       
139  ::
140 
141    numericIf: function(value)
142
143  Converts a string that appears to be a numeric value into a number.
144
145  *Returns*
146 
147  ``{Number|String}`` a Number if the passed value is a number, a String otherwise.
Note: See TracBrowser for help on using the repository browser.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png