RSSAll Entries Tagged With: "string"

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 [...]

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 fed through the url_escape() function it becomes:
$safestring\n"),
end_html;
exit;

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;

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 matched string
Example:

SELECT name, REPLACE (name, ‘m’, ‘M’) FROM product;

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 SUBSTRING(name,3,5) FROM product;

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;

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;

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;

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;

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;