UtilStringGenerateTypos Method
Simulate random typographical errors in the input text, based on the specified error rate.
Rules:
● The error-rate percentage calculation is done for the input text length,
instead of throwing the dice for each character.
● Letters can only be replaced with different letters of the same case (upper-case or lower-case).
● Numbers can only be replaced with different numbers.
● Special characters like punctuation and white-spaces will remain untouched.
Namespace: DevCase.Core.DataProcessing.CommonAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static string GenerateTypos(
string input,
int errorRate,
bool letters,
bool numbers
)
Public Shared Function GenerateTypos (
input As String,
errorRate As Integer,
letters As Boolean,
numbers As Boolean
) As String
Dim input As String
Dim errorRate As Integer
Dim letters As Boolean
Dim numbers As Boolean
Dim returnValue As String
returnValue = UtilString.GenerateTypos(input,
errorRate, letters, numbers)
public:
static String^ GenerateTypos(
String^ input,
int errorRate,
bool letters,
bool numbers
)
static member GenerateTypos :
input : string *
errorRate : int *
letters : bool *
numbers : bool -> string
No code example is currently available or this language may not be supported.
- input String
-
The input text.
- errorRate Int32
-
The error rate percentage. It must be in the range of 0 to 100.
Note: The error-rate percentage calculation is done for the input text length,
instead of throwing the dice for each character.
If this value is 0, no changes are made to the input text.
If error rate is too small for the length of the input text, it may not add any typos.
Suggested values can go between 1 to 5 percent.
Higher values will produce more typos, so more unrealistic simulations.
- letters Boolean
-
Optional. If true, allows to simulate random typographical errors in letters. Default value is True.
Note: Letters can only be replaced with different letters of the same case (upper-case or lower-case).
- numbers Boolean
-
Optional. If true, allows to simulate random typographical errors in numbers. Default value is True.
Note: Numbers can only be replaced with different numbers.
String
The resulting text with random typographical errors added.
This is a code example.
No code example is currently available or this language may not be supported.
Dim inputText As String = "I possess the virtues of rapid and error-free typing. Through my precise keystrokes and unwavering focus, I consistently deliver written content efficiently and accurately.
My typing speed is unparalleled, allowing me to swiftly transcribe thoughts into written form with remarkable velocity. Each keystroke is executed with precision, enabling me to maintain a consistent flow of text while adhering to the highest standards of accuracy.
In addition to speed, my dedication to perfection ensures that typographical errors are virtually non-existent in my output. Meticulously reviewing each line of text, I meticulously detect and rectify any potential errors, guaranteeing a polished and professional final product.
Whether it's crafting detailed reports, composing compelling articles, or engaging in fast-paced communication, my quick and error-free typing abilities empower me to meet deadlines with ease and precision. I take pride in my proficiency, knowing that it contributes to a seamless and efficient workflow.
In summary, my virtuosity in fast and error-free typing is a testament to my commitment to professionalism and excellence. With swift keystrokes and unwavering accuracy, I offer a valuable asset for any task that demands efficiency, precision, and an impeccable attention to detail."
Dim errorrate As Integer = 2 ' 2 percent of the total input text length.
Dim letters As Boolean = True
Dim numbers As Boolean = True
Dim result As String = GenerateTypos(inputText, errorrate, letters, numbers)
Console.WriteLine(result)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.