ShoneSharp Language (S #) design and use introduction series (6)-String,ShoneSharp Language (S #) design and use introduction series (6)-String Author: Shone
Disclaimer: you are welcome to repost the original article, but please indicate the source,
A string is a finite sequence consisting of 0 or more characters. In general, the sequential storage structure is used, and the end ends with ' I ', but does not count to the length of the string.
Sample program: (Adapted from "liar data
Access user environment
The user environment is a server or workstation that contains a database. The database includes the following content: copy a formula, a proxy triggered when a new email arrives or periodically, and select a formula or a
Accessing the user environment
The user environment is the server or workstation that contains the database, and the database includes the following: Copy the formula, the agent to which the new message arrives, or the timer trigger, the selection
The Lua interpreter has limited support for strings. A program can create and connect strings, but cannot intercept substrings, check the size of strings, and check the content of strings. The function of manipulating strings in Lua is basically
Since it is the first article after the opening, Let's first look at a simple and practical function to enhance your confidence and then step by step to the complexity, it's easy to let it go.
I still remember that when I was a beginner in C, I had
Capture
Capture is a mechanism in which part of the pattern string can be used to match part of the target string. Enclose the pattern you want to capture in parentheses and specify a capture.When string. Find uses capture, the function returns the
First, understand the next array1, agreed Next[0]=-1,At the same time, it can be assumed that there is a wildcard "*" at the front of the sub string, which can be matched arbitrarily. Corresponds to the actual code t2, Next[j] can have the following
Depth Copy
= = Compares the contents of the data, if it is true that the content is the same, the reference is different
= After the operation is executed, the reference address of the front and back two elements is the sameShallow copy
A summary of how Linux character channeling is intercepted1. Summary of Commands
${target-string#*sub-string}
${target-string##*sub-string}
${target-string%sub-string*}
${target-string%%*sub-string*}
-------------
First, let's create a simple string, and we will often operate on it for example:
VaR string = 'laziness always pays off now .';String. gsubThe gsub method is similar to the native replace method of JavaScript, but it is more powerful. It accepts
Learn more about Lua
I take notes from the Lua game development practice guide, which mainly records some knowledge points in the book.
1. Functions
A function is the main tool used to divide the game script function. It is a Lua code block called
Today, you need to write a small tool to parse CSV data to Lua, which uses the string in the Lua library. gsub () has never been very familiar with this method. Today, I finally tried it well. It is very powerful, enjoyable, and convenient...
The
I. Numbers
Ruby supports integers and floating-point numbers. integers can be of any length.
Integers within a certain range are stored in binary. They belong to the fixnum type. If they exceed this range, they are automatically converted to
Q: Under what circumstances does "pattern" match an empty string?A: Be careful to use * and as - they can match 0 times.-- 如果你打算用"%a*"匹配单词,你会发现到处都是单词。print(string.find(";$% **#$hello13""%a*")) --> 1 0print(string.find(";$% **#$hello13""%a*"6)
I. Numbers
Ruby supports integers and floating-point numbers. integers can be of any length.
Integers within a certain range are stored in binary. They belong to the fixnum type. If they exceed this range, they are automatically converted to the
Method
Describe
String.capitalize ()
Returns a copy of the first-letter uppercase string
String.center (width[, Fillchar])
Returns a string with a length of max (len (string), width) and a copy of string
First, the number
Ruby supports integers and floating-point numbers, and integers can be arbitrary lengths
A range of integers are stored in binary, they belong to the Fixnum type, and are automatically converted to the Bignum type when
Directly connected to the previous code:1 //KMP Algorithm2 Public classKMP {3 4 //gets the next array method, based on the given string5 Public Static int[] GetNext (String sub) {6 7 intj = 1, k = 0;8 int[] Next =New
Q: The correlation function of pattern matching string?A:--[[String.find (s, pattern [, init [, plain]]) in the string"S"To find the first match pattern in a"pattern"Matches the substring, the function returns the starting and ending positions of
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.