UNPKG

@mlightcad/common

Version:

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://img.shields.io/npm/v/@mlightcad/common.svg)](https://www.npmjs.com/package/@mlightcad/common)

44 lines 1.64 kB
/** * @fileoverview String manipulation utilities for the AutoCAD Common library. * * This module provides utility functions for common string operations, * including formatting and conversion utilities. * * @module AcCmStringUtil * @version 1.0.0 */ /** * Utility class providing static methods for string operations and formatting. * * Contains helper functions for data formatting, size conversions, and other * string manipulation tasks commonly needed in AutoCAD file processing. * * @class AcTrStringUtil * @version 1.0.0 */ export declare class AcTrStringUtil { /** * Converts a byte count to a human-readable string using appropriate size units. * * Automatically selects the most appropriate unit (B, KB, MB, GB, TB) based on the size * and formats the result with the specified number of decimal places. * * @param {number} bytes - The number of bytes to format. * @param {number} [decimals=2] - Number of decimal places to include in the result. * @returns {string} A formatted string with the appropriate unit. * * @example * ```typescript * import { AcTrStringUtil } from './AcCmStringUtil' * * // Format different byte sizes * AcTrStringUtil.formatBytes(0) // "0 B" * AcTrStringUtil.formatBytes(1024) // "1 KB" * AcTrStringUtil.formatBytes(1024 * 1024) // "1 MB" * AcTrStringUtil.formatBytes(1536, 1) // "1.5 KB" * AcTrStringUtil.formatBytes(2048000, 0) // "2 MB" * ``` */ static formatBytes(bytes: number, decimals?: number): string; } //# sourceMappingURL=AcCmStringUtil.d.ts.map