ソースコード
private static bool HasDuplicateCharacters( string self )
{
for ( var i = 0; i < self.Length - 1; i++ )
{
for ( var j = i + 1; j < self.Length; j++ )
{
if ( self[ i ] == self[ j ] )
{
return true;
}
}
}
return false;
}
使用例
Debug.Log( HasDuplicateCharacters( "りんご" ) );
Debug.Log( HasDuplicateCharacters( "リンゴ" ) );
Debug.Log( HasDuplicateCharacters( "もも" ) );
Debug.Log( HasDuplicateCharacters( "モモ" ) );
Debug.Log( HasDuplicateCharacters( "ばなな" ) );
Debug.Log( HasDuplicateCharacters( "バナナ" ) );