Tag Archives: string

Analyzing the query string in Javascript

<script language="JavaScript" type="text/JavaScript"> var getdata = []; if (location.search.length > 1) { var ls = location.search.substring(1); var namevalue = ls.split("&"); for (var i=0; i<namevalue.length; i++) { var data = namevalue[i].split("="); getdata[data[0]] = data[1]; } } var s = ""; for … Continue reading

Posted in Language basics | Tagged , , | Leave a comment

LINQ where clause with substrings

using System; using System.Linq; class WhereDemo2 { static void Main() { string[] strs = { ".com", ".net", "someNameA.com", "someNameB.net", "test", ".network", "someNameC.net", "someNameD.com" }; // Create a query that obtains Internet addresses that // end with .net. var netAddrs = … Continue reading

Posted in Where | Tagged , | Leave a comment

Getting a Safe String with uri_escape

#!/usr/bin/perl -T use strict; use URI::Escape; use CGI qw/:standard/; my $unsafestring = "\$5/[3454]/this is a windows filename.asp"; my $safestring = uri_escape($unsafestring); print header, start_html("Making URLs Safe Is Our Business"), p("The string that is unsafe for a URL is: $unsafestring\n"), p("When … Continue reading

Posted in Modules | Tagged , | Leave a comment

Printing the String Input Using the CGI Module

#!/usr/bin/perl -T use strict; use CGI qw/:standard/; print header, start_html(’Hello’), start_form, "Enter your name: ",textfield(’name’), submit, end_form, hr; if (param()) { print "Hello ", param(’name’), p; } print end_html; exit;

Posted in CGI | Tagged , | Leave a comment

SQL string function REPLACE()

SQL string function REPLACE() Syntax: REPLACE(column_name, Find, Replace) Description: Used to replace an occurence of string/character in column data Parameters: Column_name – specifies the column to be manipulated Find – string to be matched Replace – string to replace the … Continue reading

Posted in MYSQL Functions | Tagged , , | Leave a comment

SQL string function SUBSTRING()

SQL string function SUBSTRING() Syntax: SUBSTRING(column_name, Start, Length). Description: Find the SUBSTRING from column data Parameters: Column_name – specifies the column to be manipulated Start – Offset on the column Length – Number of characters to be extracted Example: SELECT … Continue reading

Posted in MYSQL Functions | Tagged , , | Leave a comment

SQL string function REVERSE()

SQL string function REVERSE() Syntax: REVERSE(column_name) Description: Find the REVERSE of column data Parameters: Column_name – specifies the column to be manipulated Example: SELECT REVERSE(name) FROM product;

Posted in MYSQL Functions | Tagged , | Leave a comment

SQL string function LENGTH()

SQL string function LENGTH() Syntax: LENGTH(column_name) Description: Find the length of column data Parameters: Column_name – specifies the column to be manipulated Example: SELECT name, price FROM product WHERE LENGTH(name)> 10;

Posted in MYSQL Functions | Tagged , , | Leave a comment

SQL string function RTRIM()

SQL string function RTRIM() Syntax: RTRIM(column_name) Description: Strips whitespace from ending of column data Parameters: Column_name – specifies the column to be manipulated Example: SELECT RTRIM(name) FROM Product;

Posted in MYSQL Functions | Tagged , , , | Leave a comment

SQL string function LTRIM()

SQL string function LTRIM() Syntax: LTRIM(column_name) Description: Strips whitespace from beginning of column data Parameters: Column_name – specifies the column to be manipulated Example: SELECT LTRIM(name) FROM Product;

Posted in MYSQL Functions | Tagged , , , | Leave a comment

SQL string function LOWER()

SQL string function LOWER() Syntax: LOWER(column_name) Description: Change the text to all lowercase. Parameters: Column_name – specifies the column to be manipulated Example: SELECT LOWER(name) FROM Product;

Posted in MYSQL Functions | Tagged , , | Leave a comment

SQL string function UPPER()

SQL string function UPPER() Syntax: UPPER (column_name) Description: Change the text to all uppercase. Parameters: Column_name – specifies the column to be manipulated Example: SELECT UPPER (name) FROM Product;

Posted in MYSQL Functions | Tagged , , | Leave a comment

Codeigniter String helper strip_quotes()

Codeigniter String helper strip_quotes() Syntax: strip_quotes(text); Parameters: Text – specifies the string to be manipulated Return type: string. Description: Removes the double quote and single quote. Example: $text = "w3mentor’s\" Code\""; echo strip_quotes($text);

Posted in Codeigniter | Tagged , | Leave a comment

Codeigniter String helper quotes_to_entities()

Codeigniter String quotes_to_entities() Syntax: quotes_to_entities(text); Parameters: Text – specifies the string to be manipulated Return type: string. Description: Changes the double quote and single quote to html special symbols Example: $text = "w3mentor’s\" Code\""; echo quotes_to_entities($text);

Posted in Codeigniter | Tagged , | Leave a comment

Codeigniter String helper trim_slashes()

Codeigniter String helper trim_slashes() Syntax: trim_slashes(text); Parameters: Text – specifies the string to be manipulated Return type: string. Description: Removes slashes at the beginning and the end of a string Example: $path = "/index.php/item/form/"; echo trim_slashes($path);

Posted in Codeigniter | Tagged , | Leave a comment

Codeigniter String helper reduce_double_slashes()

Codeigniter String helper reduce_double_slashes() Syntax: Reduce_double_slashes(text) Parameters: Text – specifies the string to be manipulated Return type: string. Description: Change the double slashes to single slashes, except for the word http://. Example: $path = "http://www.w3mentor.com//index.php"; echo Reduce_double_slashes($path);

Posted in Codeigniter | Tagged , | Leave a comment

Codeigniter String helper repeater()

Codeigniter String helper repeater() Syntax: repeater(Text, Count) Parameters: Text – specifies the string to be repeated. Count – Specifies the number of repetitions Return type: string. Description: Used to repeat text a count number of times. Example: echo repeater ("w3mentor.com\n", … Continue reading

Posted in Codeigniter | Tagged , | Leave a comment

Codeigniter String helper random_string()

Codeigniter String helper random_string() Syntax: Random_string(Type,Length) Parameters: Type specifies the type of random string to be generated. alnum – random and alphanumeric mix variables numeric – random numbers only nozero – random number of non-zero variables unique = random value … Continue reading

Posted in Codeigniter | Tagged , | Leave a comment

MySQL String Functions

BINARY string1=BINARY(string2) Returns the binary representation of a string. This function can be used to force case-sensitive comparisons when they would otherwise not occur. BIT_LENGTH bits=BIT_LENGTH(string) Returns the number of bits in a string. CHAR_LENGTH length=CHAR_LENGTH(string) Returns the number of … Continue reading

Posted in MYSQL Functions | Tagged , | Leave a comment

Strip out leading whitespace in perl

The code in the example removes leading whitespace from the text of the here document. The /m modifier lets the ^ character match at the start of each line in the string, and the /g modifier makes the pattern matching … Continue reading

Posted in Perl string manipulation | Tagged , , | Leave a comment