无效的八进制数字错误 [英] Invalid octal digit error

查看:39
本文介绍了无效的八进制数字错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Ruby 中无效的八进制数字错误,我该如何绕过?我有一个号码,0962833,我需要将它发送到 API,但我无法发送它,因为我收到了无效的八进制数字错误.

Invalid octal digit error in Ruby, how do I by pass that? I have a number, 0962833, which I need to send to an API but I can't send it since I get this invalid octal digit error.

我需要解决这个问题而不将该数字转换为字符串,零不能被删除,这是必须的.

I need a work around for that without turning that number into a string, the zero can't be removed, it's a must.

推荐答案

八进制数使用数字 0 到 7.也许错误可能是数字中的数字 9 和数字 8.如果您想传递数字962833",请先尝试使用在线转换器将其转换为正确的八进制数.然后添加前导0"并将其传递给您的函数.

Octal numbers use the digits 0 to 7. Maybe the error could be the digit 9, and digit 8 in your number. If you want to pass the number '962833', try converting it first to a correct octal number with an online converter. Then add the leading '0' and pass it to your function.

这篇关于无效的八进制数字错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆