Linux Gvim Shell String

Source: Internet
Author: User

#字符串: As the number is the most commonly used type, the other is nothing to use.
#字符串可以使用单引号, double quotes, without quotes.
#单引号字符串限制:
# 1. Any character is output as is, and the variable in single quotation marks is invalid
# 2. Single quotes cannot appear in single-quote strings, nor can I use escape characters
# str= ' This is a string '
#双引号优点:
# 1. can have variables
# 2. Escape characters can appear

1 your_name='matto'2 str="  Hello, I know you is \" ${your_ name} \ "! \ n"3echo""

#拼接字符串

1 name="matto"2echo""3 greeting="Hello, \" ${name} \ "! \ n"4 greeting_1="  Hello, ${name}! " 5 Echo " "

#获取字符串长度

1 str="matto"2echo ${#str}

#获取字符串的一部分. The first digit of the string is the 0,1:4, or 2–5 character.

1 str="thisis a str"2echo ${str:1:4 }    

#查找子字符串

1 str="Alibaba is a great company"2echo 'expr" "is"  



Linux Gvim Shell String

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.