String.iter 函数 (F#)

将指定的函数应用于字符串中的每个字符。

命名空间/模块路径: Microsoft.FSharp.Core.String

程序集:FSharp.Core(在 FSharp.Core.dll 中)

// Signature:
String.iter : (char -> unit) -> string -> unit

// Usage:
String.iter action str

参数

  • action
    类型:char -> unit

    要应用于字符串中每个字符的函数。

  • str
    类型:string

    输入字符串。

异常

异常

Condition

ArgumentNullException

在输入字符串为 null 时引发。

备注

此函数在编译的程序集中名为 Iterate。 如果从 F# 以外的语言中访问函数,或通过反射访问成员,请使用此名称。

平台

Windows 8,Windows 7,Windows server 2012中,Windows server 2008 R2

版本信息

F#核心库版本

支持:2.0,4.0,可移植

请参见

参考

Core.String 模块 (F#)

Microsoft.FSharp.Core 命名空间 (F#)