Showing posts with label string. Show all posts
Showing posts with label string. Show all posts

22 July 2021

Template string in javascript

const name = "world";
const message = `Hello ${name}`;
console.log(message);

Output:

Hello world           

Github link : https://github.com/adi501/JavaScriptExamples.git



Multiline string example in Javascript

console.log(`
this is a
multiline string
example`);

Output:

this is a 

multiline string 

example           

Github link : https://github.com/adi501/JavaScriptExamples.git



10 March 2014

Get Row Values as Comma Separated String in sql server

create table tbl_name(Name varchar(20))

insert into tbl_name values('adi')
insert into tbl_name values('jc')
insert into tbl_name values('ravi')
insert into tbl_name values('raghu')

DECLARE @name_list VARCHAR(MAX)
SELECT @name_list = COALESCE(@name_list+',' ,'') + Name from tbl_name
SELECT @name_list

OUTPUT

adi,jc,ravi,raghu

15 February 2014

How to Encoding & Decoding the string in asp.net



string  message ="adi";
string str=obj.encode(str);
str=obj.decode(str);
public string encode(string message)
    {
        return Convert.ToBase64String(Encoding.UTF8.GetBytes(message));
    }
    public string decode(string message)
    {
        return Encoding.UTF8.GetString(Convert.FromBase64String(message));
    }