# CalculationString **Repository Path**: fanwen-magician/calculation-string ## Basic Information - **Project Name**: CalculationString - **Description**: CalculationString 可以使开发者更加方便的计算字符串类型的数据。强大的自定义运算符功能,使字符串的计算更加多样化。 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2021-12-31 - **Last Updated**: 2022-06-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # CalculationString
### 介绍 CalculationString 可以使开发者更加方便的计算字符串类型的数据。强大的自定义运算符功能,使字符串的计算更加多样化。
比如说要处理字符串 "2+5" ,只需要把加号运算符挂载到程序上,就可以直接进行计算。
如要处理这种 "2d5" 这种运算符,只需要写好运算符的逻辑并挂载到程序上,就可以直接进行计算。 ### 特点 1. 轻量级
CalculationString 没有依赖任何框架,学习成本较少。且仅需要java8及以上环境。 2. 面向接口编程
CalculationString 使用了面向接口编程的编程思路,开发者只需要继承指定接口或抽象类,即可使用。 ### 声明 * CalculationString 是完全免费且开放源代码的框架,请勿用于非法用途
* CalculationString 不会通过任何方式强制收取费用,或对使用者提出物质条件
#### 许可证 [LICENSE](/LICENSE)
CalculationString 采用 Apache License 2.0 协议开源。
### 安装教程 1. 在maven中导入以下包
```xml top.fangwenmagician calculation-string 1.0.1 ``` ### 快速上手 创建CalculationFactory对象并挂在运算符,之后通过builder()函数创建CalculationString对象进行计算
```java import top.fangwenmagician.calculationstring.CalculationFactory; import top.fangwenmagician.calculationstring.CalculationString; import top.fangwenmagician.calculationstring.log.DefaultLog; public class test { public static void main(String[] args) throws Exception { // 使用工厂函数创建默认 CalculationString 对象 CalculationString calculationString = CalculationFactory.newDefaultCalculationString(); // 创建日志对象 DefaultLog defaultLog = new DefaultLog(); // 模拟输入的表达式 String e = "3*(3+5-2*2)/2"; defaultLog.startLog(e); // 开始计算并输出结果 System.out.println("==============计算结果=============="); System.out.println(calculationString.calculation(e, defaultLog)); // 输出日志 System.out.println("==============输出日志=============="); System.out.println(defaultLog); } } ``` ### 文档 在文档中,我会详细介绍 CalculationString 框架的各种使用方式,按照步骤来,总会明白的:) 1. [基本使用方式](/docs/CalculationString.md) 2. [新建运算符](/docs/Operator.md) 3. [新建日志](/docs/Log.md) 4. [流程控制器](/docs/ProcessControl.md)