BASE . LOG, 'log_file_id' => $LOG_FILE_ID, 'log_per_date' => true, ]); $byte_class = 'CoreLibs\Convert\Strings'; $PAGE_NAME = 'TEST CLASS: STRINGS CONVERT'; print ""; print "" . $PAGE_NAME . ""; print ""; print '
Class Test Master
'; print '

' . $PAGE_NAME . '

'; $split = '4-4-4'; $split_length = 4; $test_strings = [ '13', '1234', '12341', '12341234', '123412341', '123412341234', '1234123412341234512345', ]; foreach ($test_strings as $string) { print "A) Convert: $string with $split to: " . Strings::splitFormatString($string, $split) . "
"; try { print "B) Convert: $string with $split_length to: " . Strings::splitFormatStringFixed($string, $split_length) . "
"; } catch (Exception $e) { print "Split not possible: " . $e->getMessage() . "
"; } } $split = '2_2'; $split_length = 2; $string = '1234'; print "A) Convert: $string with $split to: " . Strings::splitFormatString($string, $split) . "
"; print "B) Convert: $string with $split_length to: " . Strings::splitFormatStringFixed($string, $split_length, "_") . "
"; $split = '2-2'; $string = 'あいうえ'; try { print "Convert: $string with $split to: " . Strings::splitFormatString($string, $split) . "
"; } catch (\Exception $e) { print "Cannot split string: " . $e->getMessage() . "
"; } print "B) Convert: $string with $split_length to: " . Strings::splitFormatStringFixed($string, $split_length, "-") . "
"; $string = 'ABCD12345568ABC13'; $format = '2-4_5-2#4'; $output = 'AB-CD12_34556-8A#BC13'; print "A) Convert: $string with $format to: " . Strings::splitFormatString($string, $format) . "
"; // try other split calls $string = "ABCDE"; $split_length = 2; $split_char = "-=-"; print "Convert: $string with $split_length / $split_char to: " . Strings::splitFormatStringFixed($string, $split_length, $split_char) . "
"; $string = "あいうえお"; $split_length = 2; $split_char = "-=-"; print "Convert: $string with $split_length / $split_char to: " . Strings::splitFormatStringFixed($string, $split_length, $split_char) . "
"; $test_splits = [ '', '2', '2-2', '2-3-4', ]; foreach ($test_splits as $split) { print "$split with count: " . Strings::countSplitParts($split) . "
"; } // check char list in list $needle = "abc"; $haystack = "abcdefg"; print "Needle: " . $needle . ", Haysteck: " . $haystack . ": " . DgS::prBl(Strings::allCharsInSet($needle, $haystack)) . "
"; $needle = "abcz"; print "Needle: " . $needle . ", Haysteck: " . $haystack . ": " . DgS::prBl(Strings::allCharsInSet($needle, $haystack)) . "
"; print "Combined strings A: " . Strings::buildCharStringFromLists(['A', 'B', 'C'], ['0', '1', '2']) . "
"; print "Combined strings B: " . Strings::buildCharStringFromLists([['F'], ['G'], 'H'], [['5', ['6']], ['0'], '1', '2']) . "
"; $input_string = "AaBbCc"; print "Unique: " . Strings::removeDuplicates($input_string) . "
"; print "Unique: " . Strings::removeDuplicates(strtolower($input_string)) . "
"; print ""; // __END__