- Notifications
You must be signed in to change notification settings - Fork2
Closed
Description
Suggest new routine, with following attributes:
Decription
Returns a random string from the given string list, which must not be empty.
AnERangeError exception is raised if the string list is empty.
Source code
functionRandomString(const SL: TStrings): string;beginif SL.Count =0then raise ERangeError.Create('RandomString called with empty string list'); Result := SL[Random(SL.Count)];end;
Snippet type
Routine.
Category
String Management
Required units
SysUtils, Classes.
Required snippets
None.
XRefs
None.
Extra
None.
Metadata
Metadata
Assignees
Labels
Projects
Status
Completed