Golang Strings Bag

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.
Package Listen to Mainimport listen (listen to the "FMT" listen to listen to "strings") Func listen to main () {Listen to listen to listen to hear the Var listen to Sayhi listen to listen to the "Hello" listen to hear//definition string and assign value Listen listen listen to hear . Println (Sayhi Listen + listen to "world") listen//String splicing listen and listen and listen to the FMT. PRINTLN (Sayhi) Listen and listen listen to the//len display string length listen to listen and listen to the FMT. Println (Sayhi[0]) listen and listen listen to//show the ASIC code of the first character listen listen listen listen to the FMT. Println (String (sayhi[0)) listen//To display the first character normally, turn it into a string type listen and listen to the Var listen to the Pi listen to the float64 listen to listen to hear listen to hear hear listen//define a floating-point type listen listen to listen to hear the FMT. Println ("%t:%d\n", int (pi), int (pi)) listen to listen to listen to listen to listen to hear hear listen hear hear hear listen listen listen listen listen to listen listen listen listen listen to hear hear hear hear hear hear hear hear hear hear hear hear listen listen to hear hear hear listen listen to hear hear hear hear hear s listen to hear hear hear listen listen listen listen listen listen listen listen listen listen listen listen listen listen listen listen listen listen listen listen listen to hear hear hear hear hear hear hear hear hear hear listen listen listen, listen, listen, listen, listen, listen, listen, listen, listen, listen, listen, listen, listen, listen, listen, listen, listen, listen, listen, hear, hear, hear, hear, hear, listen, hear, hear, hear, hear, listen, hear and hear. Repeat (sayhi,3)) listen//Repeat three times listen and listen to hear the fmt.println (strings. Index (Sayhi, "El")) listen//Check whether it is contained in a string, does not contain a return "1", contains a sequence character that returns the first match to listen and listen to hear the fmt.println (strings. Replace (Sayhi, "E", "ee",-1)) listen//Substitute listen and listen to hear fmt.println (strings. ToLower (Sayhi)) Listen and listen listen//convert all lowercase listen listen to hear listen to listen to hear fmt.println (strings. ToUpper (Sayhi)) Listen and listen listen to listen to listen to hear listen//convert all caps listen to hear listen to listen to hear fmt.println (strings. Count (Sayhi, "El") Listen, listen, listen, listen, listen, hear, or match the number of times.Listen and listen to FMT.PRINTLN (strings. Trimspace ("Listen to a listen lone listen to Gopher listen")) listen//Remove the string before and after the space}


This article is from the "Cheat One World de blog" blog, please be sure to keep this source http://qiyishi.blog.51cto.com/5731577/1894895

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.