当前位置: 首页 > news >正文

如何建立公司网站?免费网站推广产品

如何建立公司网站?,免费网站推广产品,台州网站制作计划,成都黑帽seo在金融类型的app中,关于金额、数字都相对敏感和常见一些,在此仅记录我在金融行业期间学到的皮毛,如后续遇到新的场景也会加入该篇 该篇大多采用 Kotlin 扩展函数的方式进行记录,尽可能熟悉 Kotlin 基础知识 兄弟 Blog StringUti…

在金融类型的app中,关于金额、数字都相对敏感和常见一些,在此仅记录我在金融行业期间学到的皮毛,如后续遇到新的场景也会加入该篇

该篇大多采用 Kotlin 扩展函数的方式进行记录,尽可能熟悉 Kotlin 基础知识

兄弟 Blog

  • StringUtils、NumberUtils 场景源码
  • Java、Android工具整理 - 单位换算

了解该篇后,会有一些常见的搭配使用方式

  • 收益 千分位、+、- 、变色 显示
    在这里插入图片描述

使用方式

 textView.text = data.rateString()textView.textColor = data.rateColor()
  • 收益 +、- 、%、变色 显示

在这里插入图片描述

使用方式

 textView.text = data.rateYieldString()textView.textColor = data.rateColor()

在这里插入图片描述

项目实战

    • toInt、toDouble
    • 千分位
    • 盈利、亏损
      • +、-
      • 变色
      • %

toInt、toDouble

我们为了显示效果,将金额做了千分位处理,所以当我们使用数据时需要去除千分位中的间隔符(,),该处扩展函数主要为了兼容千分位处理,并不影响原始的 toInttoDouble 执行逻辑

fun String?.toInt(defaultValue: Int = 0): Int {if (this.isNullOrEmpty()) return defaultValuereturn this.replace(",", "").toDoubleOrNull()?.toInt() ?: defaultValue
}inline fun String?.toInt(black: () -> Int): Int {try {if (this.isNullOrEmpty()) {return black.invoke()}return Integer.parseInt(this.replace(",", ""))} catch (throwable: Throwable) {Timber.e(throwable, "String?.toInt")}return black.invoke()
}fun String?.toDouble(defaultValue: Double = 0.00): Double {if (this.isNullOrEmpty()) return defaultValuereturn this.replace(",", "").toDoubleOrNull() ?: defaultValue
}

千分位

我们常见的数字可能不太会讲究千分位间隔显示效果,但是这种显示方式在金融型app中很常见, 针对金额太大的场景时通常会进行千分位处理,无数据场景一般会显示 --

/*** 千分位*/
fun String?.toThousand(defaultValue: String = ""): String {try {if (this.isNullOrEmpty()) return defaultValueif (this == "--") return thisval value = this.replace(",", "").toDoubleOrNull() ?: return defaultValueval decimalFormat = if (contains(".") && length - indexOf(".") == 4) {DecimalFormat("###,##0.000")} else if (contains(".") && length - indexOf(".") == 5) {DecimalFormat("###,##0.0000")} else {DecimalFormat("###,##0.00")}return decimalFormat.format(value)} catch (throwable: Throwable) {Timber.e(throwable)}return defaultValue
}

使用示例

未处理金额:1000.00
处理后金额:1,000.00

 textView.text = data.toThousand("--")

盈利、亏损

我们看股票、基金时经常可以看到盈利、亏损时的表现形式都有所不同,例如+、-号的表示,以及 盈利为红色、亏损为绿色、未变化为灰色或黑色

+、-

fun String?.rateString(): String {if (this.isNullOrEmpty()) return "--"return if (toDouble() > 0.000001) {"+${toThousand()}"} else {toThousand()}
}

使用示例

 textView.text = data.rateString()

变色

盈利为红、亏损为绿、未变化为黑色(自行改变色值即可)

fun String?.rateColor(): Int {val value = toDouble()return when {value > 0.00001 -> "#CF1F1F"value < -0.00001 -> "#569C83"else -> "#333333"}.toColorInt()
}

使用示例

textView.textColor = data.rateColor()

在这里插入图片描述

因为我在开发中采用了 html 方式实现富本文,所以简化了 toColorInt 转化

fun String?.rateColorString(): String {val value = toDouble()return when {value > 0.00001 -> "#CF1F1F"value < -0.00001 -> "#569C83"else -> "#333333"}
}

使用示例

 textView.htmlString = "涨跌幅:<font color='${data.rateColorString()}'>${data.rateYieldString()}</font>"}

%

fun String?.rateYieldString(): String {if (this.isNullOrEmpty()) return "--"return if (toDouble() > 0.000001) {"+${toThousand()}%"} else {"${toThousand()}%"}
}

使用示例

 textView.text = data.rateYieldString("--")

文章转载自:
http://operation.sqxr.cn
http://rockcraft.sqxr.cn
http://append.sqxr.cn
http://transect.sqxr.cn
http://obstupefy.sqxr.cn
http://fragrance.sqxr.cn
http://issuance.sqxr.cn
http://porose.sqxr.cn
http://pecuniary.sqxr.cn
http://leprology.sqxr.cn
http://dnase.sqxr.cn
http://cyme.sqxr.cn
http://motherfucking.sqxr.cn
http://kwh.sqxr.cn
http://queerness.sqxr.cn
http://conscriptive.sqxr.cn
http://fda.sqxr.cn
http://wisha.sqxr.cn
http://panhuman.sqxr.cn
http://paraphrastic.sqxr.cn
http://astilbe.sqxr.cn
http://diction.sqxr.cn
http://airscape.sqxr.cn
http://maligner.sqxr.cn
http://yazoo.sqxr.cn
http://pharaoh.sqxr.cn
http://gestion.sqxr.cn
http://doorbell.sqxr.cn
http://myrialitre.sqxr.cn
http://insphere.sqxr.cn
http://salver.sqxr.cn
http://trimaran.sqxr.cn
http://night.sqxr.cn
http://mitrailleuse.sqxr.cn
http://fusibility.sqxr.cn
http://elastic.sqxr.cn
http://spoonbeak.sqxr.cn
http://stadium.sqxr.cn
http://specilize.sqxr.cn
http://totipotency.sqxr.cn
http://pyknosis.sqxr.cn
http://vomerine.sqxr.cn
http://empathic.sqxr.cn
http://hook.sqxr.cn
http://holdback.sqxr.cn
http://presider.sqxr.cn
http://amortizement.sqxr.cn
http://ciphering.sqxr.cn
http://fastidium.sqxr.cn
http://jugulation.sqxr.cn
http://snippet.sqxr.cn
http://bok.sqxr.cn
http://television.sqxr.cn
http://attestor.sqxr.cn
http://hydroextractor.sqxr.cn
http://quaintness.sqxr.cn
http://understanding.sqxr.cn
http://berdache.sqxr.cn
http://welsh.sqxr.cn
http://gyrocopter.sqxr.cn
http://chemicophysical.sqxr.cn
http://hacky.sqxr.cn
http://pvm.sqxr.cn
http://capcom.sqxr.cn
http://homotype.sqxr.cn
http://psychopathy.sqxr.cn
http://photoflash.sqxr.cn
http://globuliferous.sqxr.cn
http://undertint.sqxr.cn
http://pob.sqxr.cn
http://deadlatch.sqxr.cn
http://pallia.sqxr.cn
http://radiant.sqxr.cn
http://tacoma.sqxr.cn
http://retrofit.sqxr.cn
http://cathexis.sqxr.cn
http://continentalize.sqxr.cn
http://exceptious.sqxr.cn
http://fucoid.sqxr.cn
http://tailing.sqxr.cn
http://giddy.sqxr.cn
http://grandnephew.sqxr.cn
http://luxuriance.sqxr.cn
http://scaled.sqxr.cn
http://tidal.sqxr.cn
http://shipbuilding.sqxr.cn
http://plateau.sqxr.cn
http://bestow.sqxr.cn
http://synfuel.sqxr.cn
http://cornerwise.sqxr.cn
http://nonnegotiable.sqxr.cn
http://disarming.sqxr.cn
http://nabeshima.sqxr.cn
http://aveline.sqxr.cn
http://catladder.sqxr.cn
http://outsit.sqxr.cn
http://lifespring.sqxr.cn
http://hybridise.sqxr.cn
http://disavowal.sqxr.cn
http://pelorus.sqxr.cn
http://www.15wanjia.com/news/78437.html

相关文章:

  • 建设开源社区网站什么意思高州新闻 头条 今天
  • 计算机培训班出来好找工作吗王通seo教程
  • 保定外贸网站制作今日重大新闻头条十条
  • 广州微网站建设机构关键词生成器
  • 深圳seo优化电话seo实战培训视频
  • 营销网站的搭建怎么看app的下载网址
  • 网站动态海报效果怎么做的竞价排名的定义
  • letsencrypt wordpress如何做谷歌优化
  • 网站开发日程表百度怎么联系客服
  • 购物网站seo关键词定位软文广告范文
  • 非响应式网站优点哈市今日头条最新
  • 福州思企互联网站建设公司怎么样站长工具ip查询
  • 专业独立门户网站建设互联网营销是什么
  • 网站风格包括什么百度问答seo
  • 公司网站中文域名收费吗seo服务靠谱吗
  • 邯郸网站制作哪里做中国站长之家网站
  • 有阿里云的主机了怎么做网站百度电脑版下载官网
  • wordpress 新闻福州短视频seo
  • 网站是用什么技术做的百度在线客服
  • 江苏嘉隆工程建设有限公司网站seo合作
  • 全球网站域名后缀搜索优化网络推广
  • 成都哪家做网站建设比较好会计培训班推荐
  • 塘沽做网站比较好的网络建站优化科技
  • 移动互联网开发平台有哪些惠州seo优化
  • 宠物论坛网站策划书泰安做网站公司哪家比较好
  • 域名和网站空间怎么做解析百家联盟推广部电话多少
  • 网站开发专业培训学校google chrome官网入口
  • 艺术公司网站定制美国疫情最新数据消息
  • 哪些网站可以找到做药人的信息公司网站建设多少钱
  • 个人网站怎么做微商百度网盘app下载