String 関数
文字列を処理するためにこれらの関数を利用します。
文字列を処理するためにこれらの関数を利用します。
strings.Chomp STRING ⟼ anyReturns the given string, removing all trailing newline characters and carriage returns. 詳しく見る »
strings.Contains STRING SUBSTRING ⟼ boolReports whether the given string contains the given substring. 詳しく見る »
strings.ContainsAny STRING SET ⟼ boolReports whether the given string contains any character within the given set. 詳しく見る »
strings.ContainsNonSpace STRING ⟼ boolReports whether the given string contains any non-space characters as defined by Unicode’s White Space property. 詳しく見る »
strings.Count SUBSTR STRING ⟼ intReturns the number of non-overlapping instances of the given substring within the given string. 詳しく見る »
strings.CountRunes INPUT ⟼ intReturns the number of runes in the given string excluding whitespace. 詳しく見る »
strings.CountWords INPUT ⟼ intReturns the number of words in the given string. 詳しく見る »
strings.Diff OLDNAME OLD NEWNAME NEW ⟼ stringReturns an anchored diff of the two texts OLD and NEW in the unified diff format. If OLD and NEW are identical, returns an empty string. 詳しく見る »
strings.FindRE PATTERN INPUT [LIMIT] ⟼ []stringReturns a slice of strings that match the regular expression. 詳しく見る »
strings.FindRESubmatch PATTERN INPUT [LIMIT] ⟼ [][]stringReturns a slice of all successive matches of the regular expression. Each element is a slice of strings holding the text of the leftmost match of the regular expression and the matches, if any, of its subexpressions. 詳しく見る »
strings.FirstUpper STRING ⟼ stringReturns the given string, capitalizing the first character. 詳しく見る »
strings.HasPrefix STRING PREFIX ⟼ boolReports whether the given string begins with the given prefix. 詳しく見る »
strings.HasSuffix STRING SUFFIX ⟼ bool指定された文字列が指定されたサフィックスで終わるかどうかを返します。 詳しく見る »
strings.Repeat COUNT INPUT ⟼ string1 つの文字列をもとに、0 個を含む複数回のコピーによって構成される新たな文字列を返します。 詳しく見る »
strings.Replace INPUT OLD NEW [LIMIT] ⟼ string入力文字列 INPUT の中の OLD を NEW に置き換えた文字列のコピーを返します。 詳しく見る »
strings.ReplaceRE PATTERN REPLACEMENT INPUT [LIMIT] ⟼ string入力文字列 INPUT の中の、置換パターンを用いた正規表現にマッチする文字列を、すべて置き換えた文字列のコピーを返します。 詳しく見る »
strings.RuneCount INPUT ⟼ intReturns the number of runes in the given string. 詳しく見る »
strings.SliceString STRING [START] [END] ⟼ stringReturns a substring of the given string, beginning with the start position and ending before the end position. 詳しく見る »
strings.Split STRING DELIM ⟼ stringReturns a slice of strings by splitting the given string by a delimiter. 詳しく見る »
strings.Substr STRING [START] [LENGTH] ⟼ stringReturns a substring of the given string, beginning with the start position and ending after the given length. 詳しく見る »
strings.Title STRING ⟼ stringReturns the given string, converting it to title case. 詳しく見る »
strings.ToLower INPUT ⟼ stringReturns the given string, converting all characters to lowercase. 詳しく見る »
strings.ToUpper INPUT ⟼ stringReturns the given string, converting all characters to uppercase. 詳しく見る »
strings.Trim INPUT CUTSET ⟼ stringReturns the given string, removing leading and trailing characters specified in the cutset. 詳しく見る »
strings.TrimLeft CUTSET STRING ⟼ stringReturns the given string, removing leading characters specified in the cutset. 詳しく見る »
strings.TrimPrefix PREFIX STRING ⟼ stringReturns the given string, removing the prefix from the beginning of the string. 詳しく見る »
strings.TrimRight CUTSET STRING ⟼ stringReturns the given string, removing trailing characters specified in the cutset. 詳しく見る »
strings.TrimSuffix SUFFIX STRING ⟼ stringReturns the given string, removing the suffix from the end of the string. 詳しく見る »
strings.Truncate SIZE [ELLIPSIS] INPUT ⟼ template.HTMLReturns the given string, truncating it to a maximum length without cutting words or leaving unclosed HTML tags. 詳しく見る »