<commit_before>!-StringFixture-! is a fixture with helper methods to allow more (String) manipulation to be done in the Wiki.
It is intended to be used is as a [[library][.FitNesse.UserGuide.WritingAcceptanceTests.SliM.LibraryTable]] to add its methods to the methods available via another fixture in s script table.

This page demonstrates the features of the class (!-nl.hsac.fitnesse.fixture.slim.StringFixture-!) and therefore uses it on its own in a script table (instead of inside a script using a different fixture).

|script|string fixture                                                                                |
|check |length of            |Hello                      |5                                           |
|ensure|text                 |Hello world!               |contains|world                              |
|reject|text                 |Hello world!               |contains|moon                               |
|check |convert to upper case|Bye                        |BYE                                         |
|check |convert to lower case|Bye                        |bye                                         |
|check |normalize whitespace |!-   Hello    World    -!  |Hello World                                 |
|check |replace all          |Hello ([A-Za-z]+)          |in      |Hello World|with|$1      |World    |
|check |replace all          |(\d{4})-(\d{1,2})-(\d{1,2})|in      |1975-12-3  |with|$3-$2-$1|3-12-1975|


Conversions to numbers (so that [[relative checks][.FitNesse.UserGuide.SliM.ValueComparisons]] can be done).

|script|string fixture                                            |
|check |convert to int   |100      |100                           |
|check |convert to int   |100      |< 101                         |
|check |convert to double|01.5020  |~=1.5                         |
|check |convert to double|1.52     |< 2                           |
|check |extract int from |(42)     |using|\((\d+)\)    |group|1|42|
|check |extract int from |A200BC001|using|A(\d+)BC(\d+)|group|2|1 |


And this can be combined with usage of [[variables/symbols][.FitNesse.UserGuide.SliM.SymbolsInTables]] and [[scenarios][.FitNesse.UserGuide.SliM.ScenarioTable]] to define more complex checks:
|scenario|compare yyyy-M-d date _ to dd-MM-yyyy _|input, output                                              |
|$date=  |replace all                            |^(\d{4})-(\d)-(\d)$    |in|@{input}|with|$1-0$2-0$3        |<commit_msg>Fix relative links<commit_after>!-StringFixture-! is a fixture with helper methods to allow more (String) manipulation to be done in the Wiki.
It is intended to be used is as a [[library][.FitNesse.UserGuide.WritingAcceptanceTests.SliM.LibraryTable]] to add its methods to the methods available via another fixture in s script table.

This page demonstrates the features of the class (!-nl.hsac.fitnesse.fixture.slim.StringFixture-!) and therefore uses it on its own in a script table (instead of inside a script using a different fixture).

|script|string fixture                                                                                |
|check |length of            |Hello                      |5                                           |
|ensure|text                 |Hello world!               |contains|world                              |
|reject|text                 |Hello world!               |contains|moon                               |
|check |convert to upper case|Bye                        |BYE                                         |
|check |convert to lower case|Bye                        |bye                                         |
|check |normalize whitespace |!-   Hello    World    -!  |Hello World                                 |
|check |replace all          |Hello ([A-Za-z]+)          |in      |Hello World|with|$1      |World    |
|check |replace all          |(\d{4})-(\d{1,2})-(\d{1,2})|in      |1975-12-3  |with|$3-$2-$1|3-12-1975|


Conversions to numbers (so that [[relative checks][.FitNesse.UserGuide.WritingAcceptanceTests.SliM.ValueComparisons]] can be done).

|script|string fixture                                            |
|check |convert to int   |100      |100                           |
|check |convert to int   |100      |< 101                         |
|check |convert to double|01.5020  |~=1.5                         |
|check |convert to double|1.52     |< 2                           |
|check |extract int from |(42)     |using|\((\d+)\)    |group|1|42|
|check |extract int from |A200BC001|using|A(\d+)BC(\d+)|group|2|1 |


And this can be combined with usage of [[variables/symbols][.FitNesse.UserGuide.WritingAcceptanceTests.SliM.SymbolsInTables]] and [[scenarios][.FitNesse.UserGuide.WritingAcceptanceTests.SliM.ScenarioTable]] to define more complex checks:
|scenario|compare yyyy-M-d date _ to dd-MM-yyyy _|input, output                                              |
|$date=  |replace all                            |^(\d{4})-(\d)-(\d)$    |in|@{input}|with|$1-0$2-0$3        |
{'fraction_non_alphanumeric': 0.1096299243931556, 'fraction_numerical': 0.026661360923199363, 'mean_word_length': 1.4474196689386563, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 29, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5397344', 'n_tokens_mistral': 1419, 'n_tokens_neox': 1282, 'n_words': 392}