Revision 892efc69
Added by Andreas Kohlbecker almost 14 years ago
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/CdmUtils.java | ||
---|---|---|
145 | 145 |
} |
146 | 146 |
} |
147 | 147 |
|
148 |
|
|
149 |
/** |
|
150 |
* Returns the trimmed value string if value is not <code>null</code>. |
|
151 |
* Returns the empty string if value is <code>null</code>. |
|
152 |
* @param value |
|
153 |
* @return |
|
154 |
*/ |
|
155 |
static public String NzTrim(String value){ |
|
156 |
return (value == null ? "" : value); |
|
157 |
} |
|
158 |
|
|
159 |
|
|
160 |
/** |
|
161 |
* Returns value if value is not <code>null</code>. Returns empty string if value is <code>null</code>. |
|
162 |
* @param value |
|
163 |
* @return |
|
164 |
*/ |
|
148 | 165 |
static public String Nz(String value){ |
149 | 166 |
return (value == null ? "" : value); |
150 | 167 |
} |
151 | 168 |
|
152 | 169 |
|
170 |
/** |
|
171 |
* Returns value if value is not <code>null</code>. Returns 0 if value is <code>null</code>. |
|
172 |
* @param value |
|
173 |
* @return |
|
174 |
*/ |
|
153 | 175 |
static public Integer Nz(Integer value){ |
154 | 176 |
return (value == null ? 0 : value); |
155 | 177 |
} |
156 | 178 |
|
179 |
/** |
|
180 |
* Returns value if value is not <code>null</code>. Returns 0 if value is <code>null</code>. |
|
181 |
* @param value |
|
182 |
* @return |
|
183 |
*/ |
|
157 | 184 |
static public Long Nz(Long value){ |
158 | 185 |
return (value == null ? 0 : value); |
159 | 186 |
} |
160 | 187 |
|
161 | 188 |
/** |
162 |
* Concatenates the an Array of Strings, using the defined seperator.
|
|
163 |
* Null values are interpreted as empty Strings
|
|
164 |
* If all Strings are null a null is returned
|
|
189 |
* Concatenates an array of strings using the defined seperator.<BR>
|
|
190 |
* <code>Null</code> values are interpreted as empty strings.<BR>
|
|
191 |
* If all strings are <code>null</code> then <code>null</code> is returned.
|
|
165 | 192 |
* @param strings |
166 | 193 |
* @param seperator |
167 | 194 |
* @return String |
... | ... | |
186 | 213 |
} |
187 | 214 |
} |
188 | 215 |
|
216 |
/** |
|
217 |
* Concatenates two strings, using the defined seperator.<BR> |
|
218 |
* <code>Null</code> values are interpreted as empty Strings.<BR> |
|
219 |
* If both strings are <code>null</code> then <code>null</code> is returned. |
|
220 |
* @see #concat(CharSequence, String[]) |
|
221 |
* @param seperator |
|
222 |
* @param string1 |
|
223 |
* @param string2 |
|
224 |
* @return String |
|
225 |
*/ |
|
189 | 226 |
static public String concat(CharSequence seperator, String string1, String string2){ |
190 | 227 |
String[] strings = {string1, string2}; |
191 | 228 |
return concat(seperator, strings); |
Also available in: Unified diff
merging /branches/cdmlib/SPRINT-Chichorieae1/ to trunk