| 1240 | |
| 1241 | |
| 1242 | String String::createPermanent(const char *inUtf8, int length) |
| 1243 | { |
| 1244 | if (!inUtf8) |
| 1245 | return String(); |
| 1246 | |
| 1247 | if (length<0) |
| 1248 | length = strlen(inUtf8); |
| 1249 | |
| 1250 | if (!length) |
| 1251 | { |
| 1252 | return emptyString; |
| 1253 | } |
| 1254 | else if (length==1) |
| 1255 | { |
| 1256 | return String::fromCharCode( *(unsigned char *)inUtf8 ); |
| 1257 | } |
| 1258 | else |
| 1259 | { |
| 1260 | String temp = create(inUtf8,length); |
| 1261 | return temp.makePermanent(); |
| 1262 | } |
| 1263 | } |
| 1264 | |
| 1265 | |
| 1266 |