Function Mid()

Mid()

This function is used to extract a set number of characters (a substring) from the within a string


Syntax:

= Mid (Base_string, Start_pos, Num_chars)

Base_string = The stringfrom which the characters are to be extracted
Start_pos = Position within the Base String from where the substring is to be extracted
Num_chars = Is the length of the substring that is to be extracted from the Base String


Example:
  • = Mid ("Excel Matic",1 , 1) - result will be - E
  • = Mid ("Excel Matic",1 , 2) - result will be - Ex
  • = Mid ("Excel Matic",1 ,31) - result will be - Exc
  • = Mid ("Excel Matic",1 , 4) - result will be - Exce
  • = Mid ("Excel Matic",1 , 5) - result will be - Excel
  • = Mid ("Excel Matic",7 , 1) - result will be - M
  • = Mid ("Excel Matic",7 , 2) - result will be - Ma
  • = Mid ("Excel Matic",7 , 3) - result will be - Mat
  • = Mid ("Excel Matic",7 , 4) - result will be - Mati
  • = Mid ("Excel Matic",7 , 5) - result will be - Matic

Note: In case you specify a position which is out of the range of the length (i.e., is larger than the length of the string, this function will return a null value. And, in case you return the length of substring which exceeds the number of characters post the start-position, the function will only return a substring till the end of Base String.
Share on Google Plus

About Dhakkanz

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment

Sunday, June 21, 2009

Function Mid()

Mid()

This function is used to extract a set number of characters (a substring) from the within a string


Syntax:

= Mid (Base_string, Start_pos, Num_chars)

Base_string = The stringfrom which the characters are to be extracted
Start_pos = Position within the Base String from where the substring is to be extracted
Num_chars = Is the length of the substring that is to be extracted from the Base String


Example:
  • = Mid ("Excel Matic",1 , 1) - result will be - E
  • = Mid ("Excel Matic",1 , 2) - result will be - Ex
  • = Mid ("Excel Matic",1 ,31) - result will be - Exc
  • = Mid ("Excel Matic",1 , 4) - result will be - Exce
  • = Mid ("Excel Matic",1 , 5) - result will be - Excel
  • = Mid ("Excel Matic",7 , 1) - result will be - M
  • = Mid ("Excel Matic",7 , 2) - result will be - Ma
  • = Mid ("Excel Matic",7 , 3) - result will be - Mat
  • = Mid ("Excel Matic",7 , 4) - result will be - Mati
  • = Mid ("Excel Matic",7 , 5) - result will be - Matic

Note: In case you specify a position which is out of the range of the length (i.e., is larger than the length of the string, this function will return a null value. And, in case you return the length of substring which exceeds the number of characters post the start-position, the function will only return a substring till the end of Base String.

Function Mid()SocialTwist Tell-a-Friend

0 comments:

Post a Comment