mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
double-quoted string literals that contain a single extended grapheme cluster SEGCL by default infer type String, but you can ask to infer Character for them. Single quoted literals continue to infer Character. Actual extended grapheme cluster segmentation is not implemented yet, <rdar://problem/16755123> Implement extended grapheme cluster segmentation in libSwiftBasic This is part of <rdar://problem/16363872> Remove single quoted characters Swift SVN r17034
36 lines
984 B
C++
36 lines
984 B
C++
//===--- Unicode.h - Unicode utilities --------------------------*- C++ -*-===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See http://swift.org/LICENSE.txt for license information
|
|
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SWIFT_BASIC_UNICODE_H
|
|
#define SWIFT_BASIC_UNICODE_H
|
|
|
|
#include "swift/Basic/LLVM.h"
|
|
#include "llvm/ADT/StringRef.h"
|
|
|
|
namespace swift {
|
|
namespace unicode {
|
|
|
|
StringRef extractFirstExtendedGraphemeCluster(StringRef S);
|
|
|
|
static inline bool isSingleExtendedGraphemeCluster(StringRef S) {
|
|
StringRef First = extractFirstExtendedGraphemeCluster(S);
|
|
if (First.empty())
|
|
return false;
|
|
return First == S;
|
|
}
|
|
|
|
} // namespace unicode
|
|
} // namespace swift
|
|
|
|
#endif
|
|
|