String.LastIndexOfAnyとは? わかりやすく解説

String.LastIndexOfAny メソッド (Char[])

Unicode 配列内の指定した 1 つ上の文字がこのインスタンス最後に見つかったインデックス位置レポートします

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Function LastIndexOfAny ( _
    anyOf As Char() _
) As Integer
Dim instance As String
Dim anyOf As Char()
Dim returnValue As Integer

returnValue = instance.LastIndexOfAny(anyOf)
public int LastIndexOfAny (
    char[] anyOf
)
public:
int LastIndexOfAny (
    array<wchar_t>^ anyOf
)
public int LastIndexOfAny (
    char[] anyOf
)
public function LastIndexOfAny (
    anyOf : char[]
) : int

パラメータ

anyOf

シークする 1 つ上の文字格納している、Unicode 文字配列

戻り値
anyOf 内の文字がこのインスタンス最後に見つかった場所のインデックス位置anyOf 内の文字見つからなかった場合は -1。

例外例外
例外種類条件

ArgumentNullException

anyOfnull 参照 (Visual Basic では Nothing) です。

解説解説

インデックス番号付けは 0 から始まります

このメソッドは、インスタンス最後文字位置から検索開始しanyOf文字が見つかるか、または最初文字位置到達するまで、インスタンス先頭向かって方向検索実行します検索では、大文字と小文字区別されます。

このメソッドは、序数 (カルチャに依存しない) 検索実行します。この検索方法では、2 つ文字Unicode スカラ値が等しいときだけ等価と見なされます。カルチャに依存した検索実行するには、CompareInfo.LastIndexOf メソッド使用します。このメソッド使用して検索すると、合字の "A" (U+00C6) のような構成済み文字を表す Unicode 値は、'AE' (U+0041, U+0045) のようにその文字構成要素正し順序出現した場合、これらの構成要素と (カルチャの種類に応じて) 等価と見なされます

使用例使用例

特定の文字列から、"is" を構成する任意の文字最後に出現するインデックス位置検索するコード例次に示します

' Sample for String.LastIndexOfAny(Char[])
Imports System
 _

Class Sample
   
   Public Shared Sub Main()
      
      Dim br1 As String
 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"
      Dim br2 As String
 = "0123456789012345678901234567890123456789012345678901234567890123456"
      Dim str As String
 = "Now is the time for all good men to come to the aid of their
 party."
      Dim start As Integer
      Dim at As Integer
      Dim target As String
 = "is"
      Dim anyOf As Char()
 = target.ToCharArray()
      
      start = str.Length - 1
      Console.WriteLine("The last character occurrence  from position
 {0} to 0.", start)
      Console.WriteLine("{1}{0}{2}{0}{3}{0}", Environment.NewLine,
 br1, br2, str)
      Console.Write("A character in '{0}' occurs
 at position: ", target)
      
      at = str.LastIndexOfAny(anyOf)
      If at > - 1 Then
         Console.Write(at)
      Else
         Console.Write("(not found)")
      End If
      Console.Write("{0}{0}{0}", Environment.NewLine)
   End Sub 'Main
End Class 'Sample
'
'This example produces the following results:
'The last character occurrence  from position 66 to 0.
'0----+----1----+----2----+----3----+----4----+----5----+----6----+-
'0123456789012345678901234567890123456789012345678901234567890123456
'Now is the time for all good men to come to the aid of their party.
'
'A character in 'is' occurs at position: 58
'
'
'
// Sample for String.LastIndexOfAny(Char[])
using System;

class Sample {
    public static void Main()
 {

    string br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-";
    string br2 = "0123456789012345678901234567890123456789012345678901234567890123456";
    string str = "Now is the time for
 all good men to come to the aid of their party.";
    int start;
    int at;
    string target = "is";
    char[] anyOf = target.ToCharArray();

    start = str.Length-1;
    Console.WriteLine("The last character occurrence  from position {0} to 0.",
 start);
    Console.WriteLine("{1}{0}{2}{0}{3}{0}", Environment.NewLine, br1, br2,
 str);
    Console.Write("A character in '{0}' occurs at position:
 ", target);

    at = str.LastIndexOfAny(anyOf);
    if (at > -1) 
        Console.Write(at);
    else
        Console.Write("(not found)");
    Console.Write("{0}{0}{0}", Environment.NewLine);
    }
}
/*
This example produces the following results:
The last character occurrence  from position 66 to 0.
0----+----1----+----2----+----3----+----4----+----5----+----6----+-
0123456789012345678901234567890123456789012345678901234567890123456
Now is the time for all good men to come to the aid of their party.

A character in 'is' occurs at position: 58


*/
// Sample for String::LastIndexOfAny(Char[])
using namespace System;
int main()
{
   String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-";
   String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456";
   String^ str = "Now is the time for all good men to come
 to the aid of their party.";
   int start;
   int at;
   String^ target = "is";
   array<Char>^anyOf = target->ToCharArray();
   start = str->Length - 1;
   Console::WriteLine( "The last character occurrence  from position {0} to
 0.", start );
   Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1,
 br2, str );
   Console::Write( "A character in '{0}' occurs at position:
 ", target );
   at = str->LastIndexOfAny( anyOf );
   if ( at > -1 )
      Console::Write( at );
   else
      Console::Write( "(not found)" );

   Console::Write( "{0}{0}{0}", Environment::NewLine );
}

/*
This example produces the following results:
The last character occurrence  from position 66 to 0.
0----+----1----+----2----+----3----+----4----+----5----+----6----+-
0123456789012345678901234567890123456789012345678901234567890123456
Now is the time for all good men to come to the aid of their party.

A character in 'is' occurs at position: 58


*/
// Sample for String.LastIndexOfAny(Char[])
import System.*;

class Sample
{
    public static void main(String[]
 args)
    {
        String br1 = "0----+----1----+----2----+----3----+----4----+----5----+"
            + "----6----+-";
        String br2 = "01234567890123456789012345678901234567890123456789012345"
            + "67890123456";
        String str = "Now is the time for all good men to
 come to the aid of "
            + "their party.";
        int start;
        int at;
        String target = "is";
        char anyOf[] = target.ToCharArray();

        start = str.get_Length() - 1;
        Console.WriteLine("The last character occurrence  from position {0}
 "
            + "to 0.", (Int32)start);
        Console.Write("{1}{0}", Environment.get_NewLine(), br1);
        Console.Write("{1}{0}", Environment.get_NewLine(), br2);
        Console.WriteLine("{1}{0}", Environment.get_NewLine(), str);
        Console.Write("A character in '{0}' occurs at position:
 ", target);

        at = str.LastIndexOfAny(anyOf);
        if (at > -1) {
            Console.Write(at);
        }
        else {
            Console.Write("(not found)");
        }
        Console.Write("{0}{0}{0}", Environment.get_NewLine());
    } //main
} //Sample
/*
This example produces the following results:
The last character occurrence  from position 66 to 0.
0----+----1----+----2----+----3----+----4----+----5----+----6----+-
0123456789012345678901234567890123456789012345678901234567890123456
Now is the time for all good men to come to the aid of their party.

A character in 'is' occurs at position: 58


*/
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

String.LastIndexOfAny メソッド (Char[], Int32)

Unicode 配列内の指定した 1 つ上の文字がこのインスタンス最後に見つかったインデックス位置レポートします検索は、指定した文字位置から開始されます。

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Function LastIndexOfAny ( _
    anyOf As Char(), _
    startIndex As Integer _
) As Integer
Dim instance As String
Dim anyOf As Char()
Dim startIndex As Integer
Dim returnValue As Integer

returnValue = instance.LastIndexOfAny(anyOf, startIndex)
public int LastIndexOfAny (
    char[] anyOf,
    int startIndex
)
public:
int LastIndexOfAny (
    array<wchar_t>^ anyOf, 
    int startIndex
)
public int LastIndexOfAny (
    char[] anyOf, 
    int startIndex
)
public function LastIndexOfAny (
    anyOf : char[], 
    startIndex : int
) : int

パラメータ

anyOf

シークする 1 つ上の文字格納している、Unicode 文字配列

startIndex

検索開始される位置

戻り値
anyOf 内の文字がこのインスタンス最後に見つかった場所のインデックス位置anyOf 内の文字見つからなかった場合は -1。

例外例外
例外種類条件

ArgumentNullException

anyOfnull 参照 (Visual Basic では Nothing) です。

ArgumentOutOfRangeException

startIndex が、このインスタンス内にない位置指定してます。

解説解説

インデックス番号付けは 0 から始まります

このメソッドは、インスタンスstartIndex文字位置から検索開始しanyOf文字が見つかるか、または最初文字位置到達するまで、インスタンス先頭向かって方向検索実行します検索では、大文字と小文字区別されます。

このメソッドは、序数 (カルチャに依存しない) 検索実行します。この検索方法では、2 つ文字Unicode スカラ値が等しいときだけ等価と見なされます。カルチャに依存した検索実行するには、CompareInfo.LastIndexOf メソッド使用します。このメソッド使用して検索すると、合字の "A" (U+00C6) のような構成済み文字を表す Unicode 値は、'AE' (U+0041, U+0045) のようにその文字構成要素正し順序出現した場合、これらの構成要素と (カルチャの種類に応じて) 等価と見なされます

使用例使用例

部分文字列から、"is" を構成する任意の文字最後に出現するインデックス位置検索するコード例次に示します

' Sample for String.LastIndexOfAny(Char[], Int32)
Imports System
 _

Class Sample
   
   Public Shared Sub Main()
      
      Dim br1 As String
 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"
      Dim br2 As String
 = "0123456789012345678901234567890123456789012345678901234567890123456"
      Dim str As String
 = "Now is the time for all good men to come to the aid of their
 party."
      Dim start As Integer
      Dim at As Integer
      Dim target As String
 = "is"
      Dim anyOf As Char()
 = target.ToCharArray()
      
      start =(str.Length - 1) / 2
      Console.WriteLine("The last character occurrence  from position
 {0} to 0.", start)
      Console.WriteLine("{1}{0}{2}{0}{3}{0}", Environment.NewLine,
 br1, br2, str)
      Console.Write("A character in '{0}' occurs
 at position: ", target)
      
      at = str.LastIndexOfAny(anyOf, start)
      If at > - 1 Then
         Console.Write(at)
      Else
         Console.Write("(not found)")
      End If
      Console.Write("{0}{0}{0}", Environment.NewLine)
   End Sub 'Main
End Class 'Sample
'
'This example produces the following results:
'The last character occurrence  from position 33 to 0.
'0----+----1----+----2----+----3----+----4----+----5----+----6----+-
'0123456789012345678901234567890123456789012345678901234567890123456
'Now is the time for all good men to come to the aid of their party.
'
'A character in 'is' occurs at position: 12
'
'
'
// Sample for String.LastIndexOfAny(Char[], Int32)
using System;

class Sample {
    public static void Main()
 {

    string br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-";
    string br2 = "0123456789012345678901234567890123456789012345678901234567890123456";
    string str = "Now is the time for
 all good men to come to the aid of their party.";
    int start;
    int at;
    string target = "is";
    char[] anyOf = target.ToCharArray();

    start = (str.Length-1)/2;
    Console.WriteLine("The last character occurrence  from position {0} to 0.",
 start);
    Console.WriteLine("{1}{0}{2}{0}{3}{0}", Environment.NewLine, br1, br2,
 str);
    Console.Write("A character in '{0}' occurs at position:
 ", target);

    at = str.LastIndexOfAny(anyOf, start);
    if (at > -1) 
        Console.Write(at);
    else
        Console.Write("(not found)");
    Console.Write("{0}{0}{0}", Environment.NewLine);
    }
}
/*
This example produces the following results:
The last character occurrence  from position 33 to 0.
0----+----1----+----2----+----3----+----4----+----5----+----6----+-
0123456789012345678901234567890123456789012345678901234567890123456
Now is the time for all good men to come to the aid of their party.

A character in 'is' occurs at position: 12


*/
// Sample for String::LastIndexOfAny(Char, Int32)
using namespace System;
int main()
{
   String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-";
   String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456";
   String^ str = "Now is the time for all good men to come
 to the aid of their party.";
   int start;
   int at;
   String^ target = "is";
   array<Char>^anyOf = target->ToCharArray();
   start = (str->Length - 1) / 2;
   Console::WriteLine( "The last character occurrence  from position {0} to
 0.", start );
   Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1,
 br2, str );
   Console::Write( "A character in '{0}' occurs at position:
 ", target );
   at = str->LastIndexOfAny( anyOf, start );
   if ( at > -1 )
      Console::Write( at );
   else
      Console::Write( "(not found)" );

   Console::Write( "{0}{0}{0}", Environment::NewLine );
}

/*
This example produces the following results:
The last character occurrence  from position 33 to 0.
0----+----1----+----2----+----3----+----4----+----5----+----6----+-
0123456789012345678901234567890123456789012345678901234567890123456
Now is the time for all good men to come to the aid of their party.

A character in 'is' occurs at position: 12


*/
// Sample for String.LastIndexOfAny(Char[], Int32)
import System.*;

class Sample
{
    public static void main(String[]
 args)
    {
        String br1 = "0----+----1----+----2----+----3----+----4----+----5----+"
            + "----6----+-";
        String br2 = "01234567890123456789012345678901234567890123456789012345"
            + "67890123456";
        String str = "Now is the time for all good men to
 come to the aid of "
            + "their party.";
        int start;
        int at;
        String target = "is";
        char anyOf[] = target.ToCharArray();

        start = (str.get_Length() - 1) / 2;
        Console.WriteLine("The last character occurrence  from position {0}
 "
            + "to 0.", (Int32)start);
        Console.Write("{1}{0}", Environment.get_NewLine(), br1);
        Console.Write("{1}{0}", Environment.get_NewLine(), br2);
        Console.WriteLine("{1}{0}", Environment.get_NewLine(), str);
        Console.Write("A character in '{0}' occurs at position:
 ", target);

        at = str.LastIndexOfAny(anyOf, start);
        if (at > -1) {
            Console.Write(at);
        }
        else {
            Console.Write("(not found)");
        }
        Console.Write("{0}{0}{0}", Environment.get_NewLine());
    } //main
} //Sample
/*
This example produces the following results:
The last character occurrence  from position 33 to 0.
0----+----1----+----2----+----3----+----4----+----5----+----6----+-
0123456789012345678901234567890123456789012345678901234567890123456
Now is the time for all good men to come to the aid of their party.

A character in 'is' occurs at position: 12


*/
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

String.LastIndexOfAny メソッド (Char[], Int32, Int32)

Unicode 配列内の指定した 1 つ上の文字がこのインスタンス最後に見つかったインデックス位置レポートします検索指定した文字位置から開始され指定した数の文字位置検査されます。

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Function LastIndexOfAny ( _
    anyOf As Char(), _
    startIndex As Integer, _
    count As Integer _
) As Integer
Dim instance As String
Dim anyOf As Char()
Dim startIndex As Integer
Dim count As Integer
Dim returnValue As Integer

returnValue = instance.LastIndexOfAny(anyOf, startIndex, count)
public int LastIndexOfAny (
    char[] anyOf,
    int startIndex,
    int count
)
public:
int LastIndexOfAny (
    array<wchar_t>^ anyOf, 
    int startIndex, 
    int count
)
public int LastIndexOfAny (
    char[] anyOf, 
    int startIndex, 
    int count
)
public function LastIndexOfAny (
    anyOf : char[], 
    startIndex : int, 
    count : int
) : int

パラメータ

anyOf

シークする 1 つ上の文字格納している、Unicode 文字配列

startIndex

検索開始される位置

count

検査する文字位置の数。

戻り値
anyOf 内の文字がこのインスタンス最後に見つかった場所のインデックス位置anyOf 内の文字見つからなかった場合は -1。

例外例外
例外種類条件

ArgumentNullException

anyOfnull 参照 (Visual Basic では Nothing) です。

ArgumentOutOfRangeException

count または startIndex が負の値です。

または

startIndexcount足した数が、このインスタンス内にない位置示してます。

解説解説

インデックス番号付けは 0 から始まります

このメソッドは、インスタンスstartIndex文字位置から検索開始しanyOf文字が見つかるか、または count文字位置到達するまで、インスタンス先頭向かって方向で検索実行します検索では、大文字と小文字区別されます。

このメソッドは、序数 (カルチャに依存しない) 検索実行します。この検索方法では、2 つ文字Unicode スカラ値が等しいときだけ等価と見なされます。カルチャに依存した検索実行するには、CompareInfo.LastIndexOf メソッド使用します。このメソッド使用して検索すると、合字の "A" (U+00C6) のような構成済み文字を表す Unicode 値は、'AE' (U+0041, U+0045) のようにその文字構成要素正し順序出現した場合、これらの構成要素と (カルチャの種類に応じて) 等価と見なされます

使用例使用例

部分文字列から、"aid" を構成する任意の文字最後に出現するインデックス位置検索するコード例次に示します

' Sample for String.LastIndexOfAny(Char[], Int32, Int32)
Imports System
 _

Class Sample
   
   Public Shared Sub Main()
      
      Dim br1 As String
 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"
      Dim br2 As String
 = "0123456789012345678901234567890123456789012345678901234567890123456"
      Dim str As String
 = "Now is the time for all good men to come to the aid of their
 party."
      Dim start As Integer
      Dim at As Integer
      Dim count As Integer
      Dim target As String
 = "aid"
      Dim anyOf As Char()
 = target.ToCharArray()
      
      start =(str.Length - 1) * 2 / 3
      count =(str.Length - 1) / 3
      Console.WriteLine("The last character occurrence from position
 {0} for {1} characters.", start, count)
      Console.WriteLine("{1}{0}{2}{0}{3}{0}", Environment.NewLine,
 br1, br2, str)
      Console.Write("A character in '{0}' occurs
 at position: ", target)
      
      at = str.LastIndexOfAny(anyOf, start, count)
      If at > - 1 Then
         Console.Write(at)
      Else
         Console.Write("(not found)")
      End If
      Console.Write("{0}{0}{0}", Environment.NewLine)
   End Sub 'Main
End Class 'Sample
'
'This example produces the following results:
'The last character occurrence from position 44 for 22 characters.
'0----+----1----+----2----+----3----+----4----+----5----+----6----+-
'0123456789012345678901234567890123456789012345678901234567890123456
'Now is the time for all good men to come to the aid of their party.
'
'A character in 'aid' occurs at position: 27
'
// Sample for String.LastIndexOfAny(Char[], Int32, Int32)
using System;

class Sample {
    public static void Main()
 {

    string br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-";
    string br2 = "0123456789012345678901234567890123456789012345678901234567890123456";
    string str = "Now is the time for
 all good men to come to the aid of their party.";
    int start;
    int at;
    int count;
    string target = "aid";
    char[] anyOf = target.ToCharArray();

    start = ((str.Length-1)*2)/3;
    count = (str.Length-1)/3;
    Console.WriteLine("The last character occurrence from position {0} for
 {1} characters.", start, count);
    Console.WriteLine("{1}{0}{2}{0}{3}{0}", Environment.NewLine, br1, br2,
 str);
    Console.Write("A character in '{0}' occurs at position:
 ", target);

    at = str.LastIndexOfAny(anyOf, start, count);
    if (at > -1) 
        Console.Write(at);
    else
        Console.Write("(not found)");
    Console.Write("{0}{0}{0}", Environment.NewLine);
    }
}
/*
This example produces the following results:
The last character occurrence from position 44 for 22 characters.
0----+----1----+----2----+----3----+----4----+----5----+----6----+-
0123456789012345678901234567890123456789012345678901234567890123456
Now is the time for all good men to come to the aid of their party.

A character in 'aid' occurs at position: 27
*/
// Sample for String::LastIndexOfAny(Char[], Int32, Int32)
using namespace System;
int main()
{
   String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-";
   String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456";
   String^ str = "Now is the time for all good men to come
 to the aid of their party.";
   int start;
   int at;
   int count;
   String^ target = "aid";
   array<Char>^anyOf = target->ToCharArray();
   start = ((str->Length - 1) * 2) / 3;
   count = (str->Length - 1) / 3;
   Console::WriteLine( "The last character occurrence from position {0} for
 {1} characters.", start, count );
   Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1,
 br2, str );
   Console::Write( "A character in '{0}' occurs at position:
 ", target );
   at = str->LastIndexOfAny( anyOf, start, count );
   if ( at > -1 )
      Console::Write( at );
   else
      Console::Write( "(not found)" );

   Console::Write( "{0}{0}{0}", Environment::NewLine );
}

/*
This example produces the following results:
The last character occurrence from position 44 for 22 characters.
0----+----1----+----2----+----3----+----4----+----5----+----6----+-
0123456789012345678901234567890123456789012345678901234567890123456
Now is the time for all good men to come to the aid of their party.

A character in 'aid' occurs at position: 27
*/
// Sample for String.LastIndexOfAny(Char[], Int32, Int32)
import System.*;

class Sample
{
    public static void main(String[]
 args)
    {
        String br1 = "0----+----1----+----2----+----3----+----4----+----5----+"
            + "----6----+-";
        String br2 = "01234567890123456789012345678901234567890123456789012345"
            + "67890123456";
        String str = "Now is the time for all good men to
 come to the aid of "
            + "their party.";
        int start;
        int at;
        int count;
        String target = "aid";
        char anyOf[] = target.ToCharArray();

        start = (str.get_Length() - 1) * 2 / 3;
        count = (str.get_Length() - 1) / 3;
        Console.WriteLine("The last character occurrence from position {0} "
            + "for {1} characters.", (Int32)start, (Int32)count);
        Console.Write("{1}{0}", Environment.get_NewLine(), br1);
        Console.Write("{1}{0}", Environment.get_NewLine(), br2);
        Console.WriteLine("{1}{0}", Environment.get_NewLine(), str);
        Console.Write("A character in '{0}' occurs at position:
 ", target);

        at = str.LastIndexOfAny(anyOf, start, count);
        if (at > -1) {
            Console.Write(at);
        }
        else {
            Console.Write("(not found)");
        }
        Console.Write("{0}{0}{0}", Environment.get_NewLine());
    } //main
} //Sample
/*
This example produces the following results:
The last character occurrence from position 44 for 22 characters.
0----+----1----+----2----+----3----+----4----+----5----+----6----+-
0123456789012345678901234567890123456789012345678901234567890123456
Now is the time for all good men to come to the aid of their party.

A character in 'aid' occurs at position: 27
*/
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

String.LastIndexOfAny メソッド



このページでは「.NET Framework クラス ライブラリ リファレンス」からString.LastIndexOfAnyを検索した結果を表示しています。
Weblioに収録されているすべての辞書からString.LastIndexOfAnyを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からString.LastIndexOfAny を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「String.LastIndexOfAny」の関連用語

String.LastIndexOfAnyのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



String.LastIndexOfAnyのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS