語言

YearMonth.Parse 方法

定義

多載

名稱 Description
Parse(String, DateTimeFormatter)
Parse(ICharSequence)

可從文字串如 2007-12 取得 YearMonth 實例。

Parse(String)
Parse(ICharSequence, DateTimeFormatter)

從特定格式化器中的文字字串取得 YearMonth 實例。

Parse(String, DateTimeFormatter)

public static Java.Time.YearMonth? Parse(string? text, Java.Time.Format.DateTimeFormatter? formatter);
static member Parse : string * Java.Time.Format.DateTimeFormatter -> Java.Time.YearMonth

參數

text
String
formatter
DateTimeFormatter

傳回

適用於

Parse(ICharSequence)

可從文字串如 2007-12 取得 YearMonth 實例。

[Android.Runtime.Register("parse", "(Ljava/lang/CharSequence;)Ljava/time/YearMonth;", "", ApiSince=26)]
public static Java.Time.YearMonth? Parse(Java.Lang.ICharSequence? text);
[<Android.Runtime.Register("parse", "(Ljava/lang/CharSequence;)Ljava/time/YearMonth;", "", ApiSince=26)>]
static member Parse : Java.Lang.ICharSequence -> Java.Time.YearMonth

參數

text
ICharSequence

解析的文字,例如「2007-12」,而非空

傳回

解析後的年月,非零

屬性

備註

可從文字串如 2007-12 取得 YearMonth 實例。 字串必須代表有效的年月。 格式必須是 uuuu-MM。 0000 到 9999 範圍外的年份必須加上加號或減號符號。

Java 參考 java.time.YearMonth.parse

適用於

Parse(String)

public static Java.Time.YearMonth? Parse(string? text);
static member Parse : string -> Java.Time.YearMonth

參數

text
String

傳回

適用於

Parse(ICharSequence, DateTimeFormatter)

從特定格式化器中的文字字串取得 YearMonth 實例。

[Android.Runtime.Register("parse", "(Ljava/lang/CharSequence;Ljava/time/format/DateTimeFormatter;)Ljava/time/YearMonth;", "", ApiSince=26)]
public static Java.Time.YearMonth? Parse(Java.Lang.ICharSequence? text, Java.Time.Format.DateTimeFormatter? formatter);
[<Android.Runtime.Register("parse", "(Ljava/lang/CharSequence;Ljava/time/format/DateTimeFormatter;)Ljava/time/YearMonth;", "", ApiSince=26)>]
static member Parse : Java.Lang.ICharSequence * Java.Time.Format.DateTimeFormatter -> Java.Time.YearMonth

參數

text
ICharSequence

要解析的文字,而非 null

formatter
DateTimeFormatter

格式化器要用,不是 null

傳回

解析後的年月,非零

屬性

備註

要加入。

Java 參考 java.time.YearMonth.parse

適用於