Package uniseg implements Unicode Text Segmentation, Unicode Line Breaking, and string width calculation for monospace fonts. Unicode Text Segmentation conforms to Unicode Standard Annex #29 (https://unicode.org/reports/tr29/) and Unicode Line Breaking conforms to Unicode Standard Annex #14 (https://unicode.org/reports/tr14/). In short, using this package, you can split a string into grapheme clusters (what people would usually refer to as a "character"), into words, and into sentences. Or, in its simplest case, this package allows you to count the number of characters in a string, especially when it contains complex characters such as emojis, combining characters, or characters from Asian, Arabic, Hebrew, or other languages. Additionally, you can use it to implement line breaking (or "word wrapping"), that is, to determine where text can be broken over to the next line when the width of the line is not big enough to fit the entire text. Finally, you can use it to calculate the display width of a string for monospace fonts. If you just want to count the number of characters in a string, you can use GraphemeClusterCount. If you want to determine the display width of a string, you can use StringWidth. If you want to iterate over a string, you can use Step, StepString, or the Graphemes class (more convenient but less performant). This will provide you with all information: grapheme clusters, word boundaries, sentence boundaries, line breaks, and monospace character widths. The specialized functions FirstGraphemeCluster, FirstGraphemeClusterInString, FirstWord, FirstWordInString, FirstSentence, and FirstSentenceInString can be used if only one type of information is needed. Consider the rainbow flag emoji: ๐ณ๏ธโ๐. On most modern systems, it appears as one character. But its string representation actually has 14 bytes, so counting bytes (or using len("๐ณ๏ธโ๐")) will not work as expected. Counting runes won't, either: The flag has 4 Unicode code points, thus 4 runes. The stdlib function utf8.RuneCountInString("๐ณ๏ธโ๐") and len([]rune("๐ณ๏ธโ๐")) will both return 4. The GraphemeClusterCount function will return 1 for the rainbow flag emoji. The Graphemes class and a variety of functions in this package will allow you to split strings into its grapheme clusters. Word boundaries are used in a number of different contexts. The most familiar ones are selection (double-click mouse selection), cursor movement ("move to next word" control-arrow keys), and the dialog option "Whole Word Search" for search and replace. This package provides methods for determining word boundaries. Sentence boundaries are often used for triple-click or some other method of selecting or iterating through blocks of text that are larger than single words. They are also used to determine whether words occur within the same sentence in database queries. This package provides methods for determining sentence boundaries. Line breaking, also known as word wrapping, is the process of breaking a section of text into lines such that it will fit in the available width of a page, window or other display area. This package provides methods to determine the positions in a string where a line must be broken, may be broken, or must not be broken. Monospace width, as referred to in this package, is the width of a string in a monospace font. This is commonly used in terminal user interfaces or text displays or editors that don't support proportional fonts. A width of 1 corresponds to a single character cell. The populear C function wcswidth() and its implementation in other programming languages is in widespread use for the same purpose. However, there is no standard for the calculation of such widths, and this package differs from wcswidth() in a number of ways, presumably to generate more visually pleasing results. To start, we assume that every code point has a width of 1, with the following exceptions: For Hangul grapheme clusters composed of conjoining Jamo and for Regional Indicators (flags), all code points except the first one have a width of 0. For grapheme clusters starting with an Extended Pictographic, any additional code point will force a total width of 2, except if the Variation Selector-15 (U+FE0E) is included, in which case the total width is always 1. Grapheme clusters ending with Variation Selector-16 (U+FE0F) have a width of 2. Note that whether these widths appear correct depends on your application's render engine, to which extent it conforms to the Unicode Standard, and its choice of font.
Package zenity provides cross-platform access to simple dialogs that interact graphically with the user. It is inspired by, and closely follows the API of, the zenity program, which it uses to provide the functionality on various Unixes. See: https://help.gnome.org/users/zenity/stable/ This package does not require cgo, and it does not impose any threading or initialization requirements.
Package dialog provides a simple cross-platform common dialog API. Eg. to prompt the user with a yes/no dialog: The general usage pattern is to call one of the toplevel *Dlg functions which return a *Builder structure. From here you can optionally call configuration functions (eg. Title) to customise the dialog, before using a launcher function to run the dialog.
Present OAuth2 dialogs to the user.
Package glcaps provides a nice interface to declare OpenGL capabilities you care about, including minimum required extensions or capabilities. Glcaps has no dependencies and is agnostic to the exact OpenGL binding used. OpenGLยฎ and the oval logo are trademarks or registered trademarks of Hewlett Packard Enterprise in the United States and/or other countries worldwide. Example using glcaps with an OpenGL binding and a struct with tags. See https://godoc.org/tawesoft.co.uk/go/glcaps#Parse for a description of the struct annotation syntax. https://www.tawesoft.co.uk/go/doc/glcaps/examples/example/ These packages are moving to https://github.com/tawesoft/golib. This is to increase security against possible supply chain attacks such as our domain name expiring in the future and being registered by someone else. Please migrate to https://github.com/tawesoft/golib (when available) instead. Most programs relying on a package in this monorepo, such as the dialog or lxstrconv packages, will continue to work for the foreseeable future. Rarely used packages have been hidden for now - they are in the git commit history at https://github.com/tawesoft/go if you need to resurrect one. License: MIT (see LICENSE.txt) Stable: yes For more information, documentation, source code, examples, support, links, etc. please see https://www.tawesoft.co.uk/go and https://www.tawesoft.co.uk/go/glcaps
Package operator implements logical, arithmetic, bitwise and comparison operators as functions (like the Python operator module). Includes unary, binary, and n-ary functions with overflow checked variants. https://www.tawesoft.co.uk/go/doc/operator/examples/simple/ https://www.tawesoft.co.uk/go/doc/operator/examples/calculator/ These packages are moving to https://github.com/tawesoft/golib. This is to increase security against possible supply chain attacks such as our domain name expiring in the future and being registered by someone else. Please migrate to https://github.com/tawesoft/golib (when available) instead. Most programs relying on a package in this monorepo, such as the dialog or lxstrconv packages, will continue to work for the foreseeable future. Rarely used packages have been hidden for now - they are in the git commit history at https://github.com/tawesoft/go if you need to resurrect one. License: MIT-0 (see LICENSE.txt) Stable: yes For more information, documentation, source code, examples, support, links, etc. please see https://www.tawesoft.co.uk/go and https://www.tawesoft.co.uk/go/operator
A monorepo for small Go modules maintained by Tawesoftยฎ This is permissively-licensed open source software but exact licenses may vary between modules. For license information, documentation, source code, support, links, etc. please see https://www.tawesoft.co.uk/go These packages are moving to https://github.com/tawesoft/golib. This is to increase security against possible supply chain attacks such as our domain name expiring in the future and being registered by someone else. Please migrate to https://github.com/tawesoft/golib (when available) instead. Most programs relying on a package in this monorepo, such as the dialog or lxstrconv packages, will continue to work for the foreseeable future. Rarely used packages have been hidden for now - they are in the git commit history at https://github.com/tawesoft/go if you need to resurrect one.
Easy for dialog with a UPnP device in golang
A tool to run yack dialogs on the console. The scripting language used for code statements and code conditions is not Squirrel, but JavaScript. However, Squirrel's "<-" assignment operator can be used and simply gets replaced with "=". YES and NO are also pre-defined as true and false. Usage: Flags: Examples:
Package lxstrconv is an attempt at implementing locale-aware parsing of numbers that integrates with golang.org/x/text. If golang.org/x/text is ever promoted to core then there will be a new version of this package named `lstrconv` (dropping the 'x'). Todo: * checks for integer overflow * different representations of negative numbers e.g. `(123)` vs `-123` * In cases where AcceptInteger/AcceptFloat reach a syntax error, they currently underestimate how many bytes they successfully parsed when the byte length of the string is not equal to the number of Unicode code points in the string. This example demonstrates British, Dutch, and Arabic locale number parsing. You can give end-users examples of the input you expect for a given locale using the /x/text package: These packages are moving to https://github.com/tawesoft/golib. This is to increase security against possible supply chain attacks such as our domain name expiring in the future and being registered by someone else. Please migrate to https://github.com/tawesoft/golib (when available) instead. Most programs relying on a package in this monorepo, such as the dialog or lxstrconv packages, will continue to work for the foreseeable future. Rarely used packages have been hidden for now - they are in the git commit history at https://github.com/tawesoft/go if you need to resurrect one. License: MIT (see LICENSE.txt) Stable: yes For more information, documentation, source code, examples, support, links, etc. please see https://www.tawesoft.co.uk/go and https://www.tawesoft.co.uk/go/lxstrconv
Package dlgs is a cross-platform library for displaying dialogs and input boxes.
Package dlgs is a cross-platform library for displaying dialogs and input boxes.
Package dlgs is a cross-platform library for displaying dialogs and input boxes.
Package dlgs is a cross-platform library for displaying dialogs and input boxes.
Package dialog provides a simple cross-platform common dialog API. Eg. to prompt the user with a yes/no dialog: The general usage pattern is to call one of the toplevel *Dlg functions which return a *Builder structure. From here you can optionally call configuration functions (eg. Title) to customise the dialog, before using a launcher function to run the dialog.
Package dlgs is a cross-platform library for displaying dialogs and input boxes.
Copyright (c) 2025 ฮฃfirma Package inboxer is a Go package for checking your gmail inbox, it has the * following features: * * - Mark emails (read/unread/important/etc) * - Get labels used in inbox * - Get emails by query (eg "in:sent after:2017/01/01 before:2017/01/30") * - Get email metadata * - Get email main body ("text/plain", "text/html") * - Get the number of unread messages * - Convert email dates to human readable format * ******************************************************************************* * USE ******************************************************************************* * CREDENTIALS: * * For inboxer to work you must have a gmail account and a file named * "client_secret.json" containing your authorization info in the root directory * of your project. To obtain credentials please see step one of this guide: * https://developers.google.com/gmail/api/quickstart/go * * >Step 1: Turn on the Gmail API * >Use this wizard (https://console.developers.google.com/start/api?id=gmail) to create or select a project in the Google Developers Console and automatically turn on the API. Click Continue, then Go to credentials. * >On the Add credentials to your project page, click the Cancel button. * >At the top of the page, select the OAuth consent screen tab. Select an Email address, enter a Product name if not already set, and click the Save button. * >Select the Credentials tab, click the Create credentials button and select OAuth client ID. * >Select the application type Other, enter the name "Gmail API Quickstart", and click the Create button. * >Click OK to dismiss the resulting dialog. * >Click the file_download (Download JSON) button to the right of the client ID. * >Move this file to your working directory and rename it client_secret.json. ******************************************************************************* * QUERIES ******************************************************************************* ******************************************************************************* * MARKING EMAILS ******************************************************************************* ******************************************************************************* * MARK ALL "UNREAD" EMAILS AS "READ" ******************************************************************************* ******************************************************************************* * GETTING LABELS ******************************************************************************* ******************************************************************************* * METADATA ******************************************************************************* ******************************************************************************* * GETTING THE EMAIL BODY ******************************************************************************* ******************************************************************************* * GETTING THE NUMBER OF UNREAD MESSAGES ******************************************************************************* // NOTE: to actually view the email text use inboxer.Query and query for unread // emails. ******************************************************************************* * CONVERTING DATES ******************************************************************************* // Convert UNIX time stamps to human readable format ******************************************************************************* * SNIPPET ******************************************************************************* // Snippets are not really part of the package but I'm including them in the doc // because they'll likely be useful to anyone working with this package.
Package dlgs is a cross-platform library for displaying dialogs and input boxes.
Package dlgs is a cross-platform library for displaying dialogs and input boxes.
Package goublu AllOutReq is the F2 Show All Output requestor Package goublu Args manages the os-passed-in args between goublu itself and Ublu. Package goublu Dialog contains any user response dialogs for Goublu. GoUblu github.com/jwoehr/goublu goublu launches and serves as a better-than-Java console for https://github.com/jwoehr/ublu Ublu, a Java-coded domain-specific language for remote programming of IBM midrange and mainframe systems. Neither this project nor Ublu are associated with IBM. Package goublu HelpReq is the F1 Help requestor. Package goublu History provides command line history in the goublu Ublu input area. Package goublu MacroExpander does expansion of macros. Package goublu Options parses and stores user options for Goublu. Package goublu ReqManager is the gocui manager for requestors. Package goublu Ublu is the struct managing execution of the Java program Ublu. Package goublu UbluManager is the gocui manager for Ublu input and output.
Package dlgs is a cross-platform library for displaying dialogs and input boxes.
Package dlgs is a cross-platform library for displaying dialogs and input boxes.
Package uniseg implements Unicode Text Segmentation, Unicode Line Breaking, and string width calculation for monospace fonts. Unicode Text Segmentation conforms to Unicode Standard Annex #29 (https://unicode.org/reports/tr29/) and Unicode Line Breaking conforms to Unicode Standard Annex #14 (https://unicode.org/reports/tr14/). In short, using this package, you can split a string into grapheme clusters (what people would usually refer to as a "character"), into words, and into sentences. Or, in its simplest case, this package allows you to count the number of characters in a string, especially when it contains complex characters such as emojis, combining characters, or characters from Asian, Arabic, Hebrew, or other languages. Additionally, you can use it to implement line breaking (or "word wrapping"), that is, to determine where text can be broken over to the next line when the width of the line is not big enough to fit the entire text. Finally, you can use it to calculate the display width of a string for monospace fonts. If you just want to count the number of characters in a string, you can use GraphemeClusterCount. If you want to determine the display width of a string, you can use StringWidth. If you want to iterate over a string, you can use Step, StepString, or the Graphemes class (more convenient but less performant). This will provide you with all information: grapheme clusters, word boundaries, sentence boundaries, line breaks, and monospace character widths. The specialized functions FirstGraphemeCluster, FirstGraphemeClusterInString, FirstWord, FirstWordInString, FirstSentence, and FirstSentenceInString can be used if only one type of information is needed. Consider the rainbow flag emoji: ๐ณ๏ธโ๐. On most modern systems, it appears as one character. But its string representation actually has 14 bytes, so counting bytes (or using len("๐ณ๏ธโ๐")) will not work as expected. Counting runes won't, either: The flag has 4 Unicode code points, thus 4 runes. The stdlib function utf8.RuneCountInString("๐ณ๏ธโ๐") and len([]rune("๐ณ๏ธโ๐")) will both return 4. The GraphemeClusterCount function will return 1 for the rainbow flag emoji. The Graphemes class and a variety of functions in this package will allow you to split strings into its grapheme clusters. Word boundaries are used in a number of different contexts. The most familiar ones are selection (double-click mouse selection), cursor movement ("move to next word" control-arrow keys), and the dialog option "Whole Word Search" for search and replace. This package provides methods for determining word boundaries. Sentence boundaries are often used for triple-click or some other method of selecting or iterating through blocks of text that are larger than single words. They are also used to determine whether words occur within the same sentence in database queries. This package provides methods for determining sentence boundaries. Line breaking, also known as word wrapping, is the process of breaking a section of text into lines such that it will fit in the available width of a page, window or other display area. This package provides methods to determine the positions in a string where a line must be broken, may be broken, or must not be broken. Monospace width, as referred to in this package, is the width of a string in a monospace font. This is commonly used in terminal user interfaces or text displays or editors that don't support proportional fonts. A width of 1 corresponds to a single character cell. The C function wcswidth() and its implementation in other programming languages is in widespread use for the same purpose. However, there is no standard for the calculation of such widths, and this package differs from wcswidth() in a number of ways, presumably to generate more visually pleasing results. To start, we assume that every code point has a width of 1, with the following exceptions: For Hangul grapheme clusters composed of conjoining Jamo and for Regional Indicators (flags), all code points except the first one have a width of 0. For grapheme clusters starting with an Extended Pictographic, any additional code point will force a total width of 2, except if the Variation Selector-15 (U+FE0E) is included, in which case the total width is always 1. Grapheme clusters ending with Variation Selector-16 (U+FE0F) have a width of 2. Note that whether these widths appear correct depends on your application's render engine, to which extent it conforms to the Unicode Standard, and its choice of font.
Package zenity provides cross-platform access to simple dialogs that interact graphically with the user. It is inspired by, and closely follows the API of, the zenity program, which it uses to provide the functionality on various Unixes. See: https://help.gnome.org/users/zenity/stable/ This package does not require cgo, and it does not impose any threading or initialization requirements.
Package dlgs is a cross-platform library for displaying dialogs and input boxes.
Package dlgs is a cross-platform library for displaying dialogs and input boxes.
vidar is a modular text editor written in go. It is intended to perform all necessary features in a single window (without any pop-up dialog boxes), be reasonably lightweight, and keep all user interaction fast and uninterrupted. The name 'vidar' comes from the old norse god of silence, patience, and revenge. This editor is designed to never get in your way (i.e. it stays quiet), wait for you to ask it for information before it provides anything (i.e. it is patient), and generally just be a good middleground between decent text editors with archaic key bindings (vim, emacs) and the proprietary crap that gets in our way more often than it helps us (goland, intellij). I guess maybe that's a form of revenge?
Package dlgs is a cross-platform library for displaying dialogs and input boxes.
Package gmail allows you to send email messages using Google GMail. You need to register the app on the Google server and get the configuration file that will be used for authorization. When you first initialize the application in the console will display the URL you need to go and get the authorization code. This code must be entered in response to the application and execution will continue. This function must be performed once the authorization keys stored in files. 1. Use wizard <https://console.developers.google.com/start/api?id=gmail> to create or select a project in the Google Developers Console and automatically turn on the API. Click Continue, then Go to credentials. 2. On the Add credentials to your project page, click the Cancel button. 3. At the top of the page, select the OAuth consent screen tab. Select an Email address, enter a Product name if not already set, and click the Save button. 4. Select the Credentials tab, click the Create credentials button and select OAuth client ID. 5. Select the application type Other, enter the name "Gmail API", and click the Create button. 6. Click OK to dismiss the resulting dialog. 7. Click the Download JSON button to the right of the client ID. 8. Move this file to your working directory and rename it client_secret.json.
Easy for dialog with a UPnP device in golang
Package dlgs is a cross-platform library for displaying dialogs and input boxes.
Package ui is a simple package which provides a way to write portable GUI programs quickly and easily. It aims to run on as many systems as Go itself, but presently has support for Windows, Mac OS X, and other Unix systems using the Windows API, Cocoa, and GTK+ 3, respectively. It also aims to be Go-like: events are transmitted via channels, and the library is fully safe for concurrent use. To use the library, place your main program code in another function and call Go(), passing that function as a parameter. (This is necessary due to threading restrictions on some environments, such as Cocoa.) Once in the function you pass to Go(), you can safely use the rest of the library. When this function returns, so does Go(), and package functions become unavailable. Building GUIs is as simple as creating a Window, populating it with Controls, and then calling Open() on the Window. A Window only has one Control: you pack multiple Controls into a Window by arranging them in layouts (Layouts are also Controls). There are presently two Layouts, Stack and Grid, each with different semantics on sizing and placement. See their documentation. Once a Window is open, you cannot make layout or event channel changes. Once your Window is open, you can begin to handle events. Handling events is simple: because all events are channels exposed as exported members of the Window and Control types, simply select on them. Event channels are initialized by default. However, before you Open a Window, you can freely reassign event channels, such that multiple events trigger the same channel, making event logic more compact. You may also choose not to handle events; events are sent asynchronously so the GUI loop is not initerrupted. Here is a simple, complete program that asks the user for their name and greets them after clicking a button. The following functions provide dialogs. They exist both in package scope and as methods on Window. Dialogs opened by using the package-scope functions are modal to the entire application: the user cannot interact with any other window until they are dismissed. Whether or not resizing Windows will still be allowed is implementation-defined; if the implementation does allow it, resizes will still work properly. Whether or not the dialog box stays above all other Windows in the program is also implementation-defined. Dialogs opened by using the Window methods are modal to the receiver Window only. Attempts to interact with the receiver Window will be blocked, but all other Windows in the application can still be used properly. The dialog box will also stay above the receiver Window. Whether the receiver Window can be resized while the dialog box is displayed is implementation-defined, but will work properly if allowed. If the receiver Window has not yet been created, the methods panic. If the receiver Window has not been shown yet or is currently hidden, what the methods do is implementation-defined. The return type also differs between the two types of functions. Both ultimately either yield a signal that the dialog has been dismissed or a code specifying what the user decided to do with the dialog (if it has multiple choices). The package-scope functions wait for the dialog box to be dismissed and merely return the code (or nothing if no code is needed). The Window methods return immediately with a channel that will eventually receive either the signal or the return code. Package ui does not close these channels, nor does it send multiple values on the same channel. The following Controls have scrolling support built in: All of the above controls have both horizontal and vertical scrollbars. These scrollbars hide themselves when not needed. [FUTURE DISCUSSIONS: scrolling programmatically, MouseEvent/KeyEvent scroll overrides] [FUTURE PLAN: Controls that are not marked with a * in the above list can have their scrollbars disabled completely in code.] The result of resizing the window such that the scrollbars consider themselves too small is implementation-defined.
Package gai provides a unified interface for interacting with various large language model (LLM) providers. The package abstracts away provider-specific implementations, allowing you to write code that works with multiple AI providers (OpenAI, Anthropic, Google Gemini) without changing your core logic. It supports text, image, audio, and PDF modalities (provider dependent), tool integration with JSON Schema-based parameters, callback-based tool execution, automatic fallback strategies for reliability, standardized error types for better error handling, and detailed usage metrics. Generator: The core interface that all providers implement. It takes a Dialog and generates a Response. Each LLM provider (OpenAI, Anthropic, Gemini) has its own implementation of the Generator interface. Dialog: A conversation with a language model, represented as a slice of Message objects. Message: A single exchange in the conversation, with a Role (User, Assistant, or ToolResult) and a collection of Blocks. Block: A self-contained piece of content within a message, which can be text, image, audio, or a tool call. Common block types include: Modalities: gai supports multiple modalities for input and output. Support for specific modalities depends on the underlying model provider. Tool: A function that can be called by the language model during generation. The InputSchema defines the parameters the tool accepts using JSON Schema conventions: Basic usage with OpenAI: Using tools with a language model: Implementing a fallback strategy between providers: gai supports PDF documents as a special case of the Image modality. PDFs are automatically converted to images at the model provider's API level: PDF support notes: The package supports multiple LLM providers with varying capabilities: OpenAI: The OpenAI implementation supports text generation, image inputs (including PDFs), audio inputs, and tool calling. Anthropic: The Anthropic implementation supports text generation, image inputs (including PDFs with special handling), and tool calling. Gemini: The Gemini implementation supports text generation, image inputs (including PDFs), audio inputs, and tool calling. The package provides standardized error types for consistent error handling across providers: Example error handling: Tool Generator: The ToolGenerator provides advanced functionality for working with tools. It automatically handles registering tools with the underlying generator, executing tool callbacks when tools are called, managing the conversation flow during tool use, and handling parallel tool calls. Example: Fallback Generator: The FallbackGenerator provides automatic fallback between different providers. It automatically tries each generator in sequence, falls back based on configurable conditions, and preserves the original error if all generators fail. Configuration options: Example: The package includes MCP (Model Context Protocol) client support for connecting to external tools and data sources. The MCP client allows you to connect to MCP servers via stdio, HTTP, or other transports and use their tools within the gai framework. Note: This MCP implementation does not support JSON-RPC batch requests/responses. All messages are sent and received individually for simplicity and forward compatibility with planned protocol changes. Example MCP usage: For more information and examples, example files in the repository. This project is licensed under the MIT License. ExampleMixGenerators demonstrates how to mix different AI model providers in a single conversation, switching between Anthropic and OpenAI models.
Package uniseg implements Unicode Text Segmentation, Unicode Line Breaking, and string width calculation for monospace fonts. Unicode Text Segmentation conforms to Unicode Standard Annex #29 (https://unicode.org/reports/tr29/) and Unicode Line Breaking conforms to Unicode Standard Annex #14 (https://unicode.org/reports/tr14/). In short, using this package, you can split a string into grapheme clusters (what people would usually refer to as a "character"), into words, and into sentences. Or, in its simplest case, this package allows you to count the number of characters in a string, especially when it contains complex characters such as emojis, combining characters, or characters from Asian, Arabic, Hebrew, or other languages. Additionally, you can use it to implement line breaking (or "word wrapping"), that is, to determine where text can be broken over to the next line when the width of the line is not big enough to fit the entire text. Finally, you can use it to calculate the display width of a string for monospace fonts. If you just want to count the number of characters in a string, you can use GraphemeClusterCount. If you want to determine the display width of a string, you can use StringWidth. If you want to iterate over a string, you can use Step, StepString, or the Graphemes class (more convenient but less performant). This will provide you with all information: grapheme clusters, word boundaries, sentence boundaries, line breaks, and monospace character widths. The specialized functions FirstGraphemeCluster, FirstGraphemeClusterInString, FirstWord, FirstWordInString, FirstSentence, and FirstSentenceInString can be used if only one type of information is needed. Consider the rainbow flag emoji: ๐ณ๏ธโ๐. On most modern systems, it appears as one character. But its string representation actually has 14 bytes, so counting bytes (or using len("๐ณ๏ธโ๐")) will not work as expected. Counting runes won't, either: The flag has 4 Unicode code points, thus 4 runes. The stdlib function utf8.RuneCountInString("๐ณ๏ธโ๐") and len([]rune("๐ณ๏ธโ๐")) will both return 4. The GraphemeClusterCount function will return 1 for the rainbow flag emoji. The Graphemes class and a variety of functions in this package will allow you to split strings into its grapheme clusters. Word boundaries are used in a number of different contexts. The most familiar ones are selection (double-click mouse selection), cursor movement ("move to next word" control-arrow keys), and the dialog option "Whole Word Search" for search and replace. This package provides methods for determining word boundaries. Sentence boundaries are often used for triple-click or some other method of selecting or iterating through blocks of text that are larger than single words. They are also used to determine whether words occur within the same sentence in database queries. This package provides methods for determining sentence boundaries. Line breaking, also known as word wrapping, is the process of breaking a section of text into lines such that it will fit in the available width of a page, window or other display area. This package provides methods to determine the positions in a string where a line must be broken, may be broken, or must not be broken. Monospace width, as referred to in this package, is the width of a string in a monospace font. This is commonly used in terminal user interfaces or text displays or editors that don't support proportional fonts. A width of 1 corresponds to a single character cell. The C function wcswidth() and its implementation in other programming languages is in widespread use for the same purpose. However, there is no standard for the calculation of such widths, and this package differs from wcswidth() in a number of ways, presumably to generate more visually pleasing results. To start, we assume that every code point has a width of 1, with the following exceptions: For Hangul grapheme clusters composed of conjoining Jamo and for Regional Indicators (flags), all code points except the first one have a width of 0. For grapheme clusters starting with an Extended Pictographic, any additional code point will force a total width of 2, except if the Variation Selector-15 (U+FE0E) is included, in which case the total width is always 1. Grapheme clusters ending with Variation Selector-16 (U+FE0F) have a width of 2. Note that whether these widths appear correct depends on your application's render engine, to which extent it conforms to the Unicode Standard, and its choice of font.
A package for computing optimal positions for keyboard accelerators (e.g., in menus or in dialogs), using the Kuhn-Munkres algorithm. (TOC)