Changeset 50503 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Feb 19, 2014 8:35:27 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/string/ministring.cpp
r40417 r50503 8 8 9 9 /* 10 * Copyright (C) 2007-201 2Oracle Corporation10 * Copyright (C) 2007-2014 Oracle Corporation 11 11 * 12 12 * This file is part of VirtualBox Open Source Edition (OSE), as … … 395 395 /* static */ 396 396 RTCString 397 RTCString::join(const RTCList<RTCString, RTCString *> &a_rList, 398 const RTCString &a_rstrSep /* = "" */) 397 RTCString::joinEx(const RTCList<RTCString, RTCString *> &a_rList, 398 const RTCString &a_rstrPrefix /* = "" */, 399 const RTCString &a_rstrSep /* = "" */) 399 400 { 400 401 RTCString strRet; … … 403 404 /* calc the required size */ 404 405 size_t cbNeeded = a_rstrSep.length() * (a_rList.size() - 1) + 1; 406 cbNeeded += a_rstrPrefix.length() * (a_rList.size() - 1) + 1; 405 407 for (size_t i = 0; i < a_rList.size(); ++i) 406 408 cbNeeded += a_rList.at(i).length(); … … 410 412 for (size_t i = 0; i < a_rList.size() - 1; ++i) 411 413 { 414 if (a_rstrPrefix.isNotEmpty()) 415 strRet.append(a_rstrPrefix); 412 416 strRet.append(a_rList.at(i)); 413 417 strRet.append(a_rstrSep); … … 417 421 /* special case: one list item. */ 418 422 else if (a_rList.size() > 0) 423 { 424 if (a_rstrPrefix.isNotEmpty()) 425 strRet.append(a_rstrPrefix); 419 426 strRet.append(a_rList.last()); 427 } 420 428 421 429 return strRet; 430 } 431 432 /* static */ 433 RTCString 434 RTCString::join(const RTCList<RTCString, RTCString *> &a_rList, 435 const RTCString &a_rstrSep /* = "" */) 436 { 437 return RTCString::joinEx(a_rList, 438 "" /* a_rstrPrefix */, a_rstrSep); 422 439 } 423 440
Note:
See TracChangeset
for help on using the changeset viewer.