flutterchina / lpinyin Goto Github PK
View Code? Open in Web Editor NEWDart 汉字转拼音,Flutter, web, other
License: BSD 2-Clause "Simplified" License
Dart 汉字转拼音,Flutter, web, other
License: BSD 2-Clause "Simplified" License
Example:
var testTrad = PinyinHelper.getPinyin('乾淨', format: PinyinFormat.WITH_TONE_MARK);
print(testTrad);
var testSimpl = PinyinHelper.getPinyin('干净', format: PinyinFormat.WITH_TONE_MARK);
print(testSimpl);
Output:
qián jìng
gān jìng
demo:
import 'package:lpinyin/lpinyin.dart';
main() {
print(PinyinHelper.getPinyin('李四',separator: ''));
print(PinyinHelper.getPinyin('小李',separator: ''));
print(PinyinHelper.getPinyin('王五',separator: ''));
}
output:
李si
xiaoli
wangwu
String name = '😃'; // some emoji word
String keyword = PinyinHelper.getFirstWordPinyin(name);
print(keyword); // output �
像 "a,b" 这种会报错,中间是英文逗号,我试了中文逗号,句号,英文句号等都可以,唯独英文逗号不行,这么什么问题?
The following RangeError was thrown while handling a gesture:
RangeError (index): Invalid value: Valid value range is empty: 0
When the exception was thrown, this was the stack:
#0 _StringBase.[] (dart:core-patch/string_patch.dart:252:55)
#1 PinyinHelper.getShortPinyin. (package:lpinyin/src/pinyin_helper.dart:51:21)
这个功能是尚未开发吗?
separator为""的情况下,拼音会少了最后一个字母
return (sb.toString().endsWith(separator)
? sb.toString().substring(0, sb.toString().length - 1)
: sb.toString());
想用来做内容的繁简转换,但是没有找到介绍里面说的 “简繁体中文转换” 的方法?
flutter can't import lpinyin.dart,error as below:
Try correcting the name to the name of an existing getter, or defining a getter or field named 'PinyinHelper'.
String pinyin = PinyinHelper.getPinyinE(user.userName);
^^^^^^^^^^^^
Unhandled exception:
FileSystemException(uri=org-dartlang-untranslatable-uri:package%3Alpinyin%2Flpinyin.dart; message=StandardFileSystem only supports file:*
and data:* URIs)
#0 StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:33:7)
#1 asFileUri (package:vm/kernel_front_end.dart:601:37)
#2
FrontendCompiler._outputDependenciesDelta (package:vm/frontend_server.dart:401:39)
#3 FrontendCompiler.compile (package:vm/frontend_server.dart:375:
13)
#4 _FlutterFrontendCompiler.compile (package:frontend_ser
ver/server.dart:31:22)
#5 starter (package:frontend_server/s
erver.dart:128:27)
#6 main (file:///C:/b/s/w/ir/k/src/flutter/frontend_ser
ver/bin/starter.dart:8:30)
#7 _startIsolate. (
dart:isolate-patch/isolate_patch.dart:299:32)
#8 _RawReceivePortImpl._handleMessage (dart:i
solate-patch/isolate_patch.dart:172:12)
Hello!
Is it possible to convert a pinyin string using numbers to the one with tone marks?
ni3hao3 => nǐhǎo
Thank you for the help!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.