add_leading_zeroes();
Add leading zeroes to a string.
ONO::Lib::Basic->add_leading_zeroes( $num, $length );
returns: $num
add_tailing_zeroes();
Add tailing zeroes to a string.
ONO::Lib::Basic->add_tailing_zeroes( );
array_flip();
Flip two strings in an array (a,b -> b,a). See also array_flip_random().
ONO::Lib::Basic->array_flip( );
returns: ($array[2],$array[1])
array_flip_random();
Flip two strings in an array (a,b -> b,a) width a 50/50 chance. See also array_flip().
ONO::Lib::Basic->array_flip_random( );
array_limit();
Limit the number of elements in an array.
ONO::Lib::Basic->array_limit( );
returns: @array
array_randomize();
Randomize array. Same as randomize_array().
ONO::Lib::Basic->array_randomize( @array );
returns: &randomize_array("",@array)
array_sortbylength();
Sort an array by the length of its elements.
ONO::Lib::Basic->array_sortbylength( @array );
array_sortbynumber();
Sort an array by number.
ONO::Lib::Basic->array_sortbynumber( @array );
cleanmail();
Clean up an e-mail address. Other characters are technically allowed, but ONO doesn't like or allow them!
ONO::Lib::Basic->cleanmail( );
returns: $string
cleanstring();
Clean up a string, allowing only numbers, letters, umlauts, and some special characters.
ONO::Lib::Basic->cleanstring( );
returns: $string
cleanurl();
Clean up an URL.
ONO::Lib::Basic->cleanurl( );
returns: $string
compact_code();
Compress HTML code. Same as html_compress().
ONO::Lib::Basic->compact_code( );
returns: &html_compress("",$_[1])
css_rotate();
Rotate an HTML element using CSS code.
ONO::Lib::Basic->css_rotate( );
returns: qq~-ms-transform:rotate($_[1]deg);-webkit-transform:rotate($_[1]deg);transform:rotate($_[1]deg);~
domain_example();
Generate a localized example domain.
ONO::Lib::Basic->domain_example( );
email_example();
Generate a localized example email address.
ONO::Lib::Basic->email_example( );
email_valid();
Check if email address is valid.
ONO::Lib::Basic->email_valid( );
html_compress();
Compress HTML code, by removing non-required spaces and line feeds, returns, and tabs.
ONO::Lib::Basic->html_compress( );
returns: $HTML
inputfield();
Clean up an input field, and trim it if required.
ONO::Lib::Basic->inputfield( );
returns: $input
inputtext();
Clean up an text field.
ONO::Lib::Basic->inputtext( );
returns: $input
num_human_readable();
Make numbers human readable by adding separators. This does NOT work with comma numbers!
ONO::Lib::Basic->num_human_readable( );
returns: $num
num_round_down();
Round number down. See also num_round_up().
ONO::Lib::Basic->num_round_down( );
returns: $num
num_round_up();
Not implemented yet. See also num_round_down().
ONO::Lib::Basic->num_round_up( );
pathbreaks();
Make a path breakable, to display it on responsive pages for example. See also pathbreaks_mail().
ONO::Lib::Basic->pathbreaks( );
returns: "$http$path"
pathbreaks_mail();
Make an email address breakable, to display it on responsive pages for example. This will automatically turn it into a clickable link. See also pathbreaks().
ONO::Lib::Basic->pathbreaks_mail( );
returns: qq~<a href="mailto:$_[1]" class="$_[2]">~.&pathbreaks("",$_[1]).qq~</a>~
random_100();
Return a random number between 0 and 99.
ONO::Lib::Basic->random_100( );
returns: int(rand(100))
random_percent();
Will return 1 on an X-to-100 percent chance
ONO::Lib::Basic->random_percent( );
randomize_array();
Randomize array. Same as array_randomize().
ONO::Lib::Basic->randomize_array( @array );
returns: @new
remove_bad_spaces();
Remove bad spaces from a string, which includes leading and tailing spaces, as well as double spaces anywhere. See also remove_bad_spaces_sentence().
ONO::Lib::Basic->remove_bad_spaces( $input, $max );
returns: $input
remove_bad_spaces_sentence();
Remove bad spaces from a sentence or a text, respecing dots, commas, etc. This automatically includes the remove_bad_spaces routine. See also remove_bad_spaces().
ONO::Lib::Basic->remove_bad_spaces_sentence( $input, $max );
returns: $input
remove_double_returns();
Automatically remove returns and tabs, optionally remove leading and tailing returns
ONO::Lib::Basic->remove_double_returns( $input, $max, $ext );
returns: $input
remove_doubles();
Remove doubles or a specific char.
ONO::Lib::Basic->remove_doubles( $input, $char, $max, $ext );
returns: $input
remove_leading_spaces();
Remove leading spaces from a string. See also remove_bad_spaces() and remove_bad_spaces_sentence().
ONO::Lib::Basic->remove_leading_spaces( );
returns: $string
remove_leading_zeroes();
Remove leading zeroes from a string. See also remove_leading_zeroes_comma().
ONO::Lib::Basic->remove_leading_zeroes( );
returns: $num
remove_leading_zeroes_comma();
Remove leading zeroes from a string, respecting comma numbers.
ONO::Lib::Basic->remove_leading_zeroes_comma( );
returns: $num
remove_tailing_spaces();
Remove tailing spaces from a string. See also remove_bad_spaces() and remove_bad_spaces_sentence().
ONO::Lib::Basic->remove_tailing_spaces( );
returns: $string
safeurl();
Make a string safe to be displayed on an HTML page.
ONO::Lib::Basic->safeurl( );
returns: $URL
shortstring();
Limit the length of a string, replace the middle of the string by dots if required.
-c cleanup, will remove double stuff
-P remove path, only keep everything behind the last slash (always applied, even if string not long)
ONO::Lib::Basic->shortstring( $input, $max, $switches );
sort_case_insensitive();
Sort an array, case insensitive.
ONO::Lib::Basic->sort_case_insensitive( );
sortstring();
Generate a sort string, which can be used to sort arrays for example. See also sortstring_wrapped().
ONO::Lib::Basic->sortstring( );
returns: $sort
sortstring_wrapped();
Generate a sort string, make it usable within HTML code. See also sortstring().
ONO::Lib::Basic->sortstring_wrapped( );
returns: "<!-- sort:".&sortstring("",$_[1])." -->"
substr_first_digit();
Return the first digit of a string.
ONO::Lib::Basic->substr_first_digit( );
returns: substr($_[1],0,1)
substr_last_digit();
Return the last digit of a string.
ONO::Lib::Basic->substr_last_digit( );
returns: substr($_[1],(length $_[1])-1,1)
textfield();
Clean up text field. See also inputtext().
ONO::Lib::Basic->textfield( );
returns: &inputtext("",$_[1])
uc();
A better upper case, which also supports some international strings (umlauts).
ONO::Lib::Basic->uc( );
returns: uc $input
ucfirstletters();
Uppercase the first letter of each word in a string. See also ucfirstletters_mkspaces().
ONO::Lib::Basic->ucfirstletters( );
returns: $input
ucfirstletters_mkspaces();
Uppercase the first letter of each word in a string, but first replace underscores by spaces. See also ucfirstletters().
ONO::Lib::Basic->ucfirstletters_mkspaces( );
returns: &ucfirstletters("",$input)
umlaut();
Count the number of different umlauts in a string. Can be used to test if a string contains umlauts at all (returns zero if not).
ONO::Lib::Basic->umlaut( );
returns: $umlaut
umlaut_make_uppercase();
Make character or string uppercase, also make umlauts uppercase.
ONO::Lib::Basic->umlaut_make_uppercase( );
returns: $UC
umlaut_reverse();
Restore umlauts in simplified string. This will ONLY work for german umlauts, and not for SS
ONO::Lib::Basic->umlaut_reverse( );
returns: $input
umlaut_simplify();
Deal with umlauts in a string in various ways, using different modes:
-0 default mode
-1 use single letters only (warning: 'ß' will also be replaced by single 's')
-2 same as 0, but will replace 'ß' by 'SS'
-3 mark umlauts: ä -> ae_, useful for exported speech files for example
ONO::Lib::Basic->umlaut_simplify( $input, $mode );
returns: $input
umlaut_string_length();
Count the number of elements in umlaut_string_to_array().
ONO::Lib::Basic->umlaut_string_length( );
returns: $length
umlaut_string_to_array();
Return an array of all letters used in an array, respecting umlauts.
ONO::Lib::Basic->umlaut_string_to_array( );
returns: @letters
umlaut_transform();
Transform crappy 2-byte string to real utf-8 umlaut code
ONO::Lib::Basic->umlaut_transform( );
returns: ¨aut_reverse("",¨aut_simplify("",$_[1],2))
umlauts();
Array of often used umlaut characters.
ONO::Lib::Basic->umlauts( );
returns: ('Ä','Ë','Ö','Ü', 'ä','à','â','ã', 'é','è','ë','ê', 'ï','î', 'ö','ô', 'ü','û', 'ç','ß')
valid_email();
Test if email address is valid.
ONO::Lib::Basic->valid_email( );
valid_ip();
Test if IP address is valid.
ONO::Lib::Basic->valid_ip( );
valid_ip_range();
Test if IP range is valid.
ONO::Lib::Basic->valid_ip_range( );
valid_url();
Test if URL is valid.
ONO::Lib::Basic->valid_url( );