place : num numkan | "同　"
9227
def parse_place
      s0 = @current_pos
      s1 = parse_num
      if s1 != :failed
        s2 = parse_numkan
        if s2 != :failed
          @reported_pos = s0
          s0 = { "x" => s1, "y" => s2 }
        else
          @current_pos = s0
          s0 = :failed
        end
      else
        @current_pos = s0
        s0 = :failed
      end
      if s0 == :failed
        s0 = @current_pos
        s1 = match_str("同　")
        if s1 != :failed
          @reported_pos = s0
          s1 = nil
        end
        s0 = s1
      end
      s0
    end
352385
public static String getPreOrNextDay(Date date,int num) {
        Calendar   ca   =   Calendar.getInstance();
        ca.setTime(date);
        ca.add(Calendar.DAY_OF_MONTH,  num);//此处要用add方法
        Date   firstDate   =   ca.getTime();
        return dateToString(firstDate);
    }
139659
private static void combineWords(Vertex[] wordNet, int start, int end, CoreDictionary.Attribute value)
    {
        if (start + 1 == end)   // 小优化，如果只有一个词，那就不需要合并，直接应用新属性
        {
            wordNet[start].attribute = value;
        }
        else
        {
            StringBuilder sbTerm = new StringBuilder();
            for (int j = start; j < end; ++j)
            {
                if (wordNet[j] == null) continue;
                String realWord = wordNet[j].realWord;
                sbTerm.append(realWord);
                wordNet[j] = null;
            }
            wordNet[start] = new Vertex(sbTerm.toString(), value);
        }
    }
916398
def parse_numkan
      s0 = @current_pos
      s1 = match_regexp(/^[一二三四五六七八九]/)
      if s1 != :failed
        @reported_pos = s0
        s1 = kan2n(s1)
      end
      s1
    end
695356
private static int wordToNumber(String s) {
        if (s.equals("零") || s.equals("0")) {
            return 0;
        } else if (s.equals("一") || s.equals("1")) {
            return 1;
        } else if (s.equals("二") || s.equals("两") || s.equals("2")) {
            return 2;
        } else if (s.equals("三") || s.equals("3")) {
            return 3;
        } else if (s.equals("四") || s.equals("4")) {
            return 4;
        } else if (s.equals("五") || s.equals("5")) {
            return 5;
        } else if (s.equals("六") || s.equals("6")) {
            return 6;
        } else if (s.equals("七") || s.equals("天") || s.equals("日") || s.equals("7")) {
            return 7;
        } else if (s.equals("八") || s.equals("8")) {
            return 8;
        } else if (s.equals("九") || s.equals("9")) {
            return 9;
        } else {
            return -1;
        }
    }
91080
function(lastope){
		// 前回と同じ場所なら前回の更新のみ
		var property = this.property;
		if( lastope.group    === this.group &&
			lastope.property === this.property  &&
			lastope.num      === this.old   &&
			lastope.bx       === this.bx    &&
			lastope.by       === this.by    &&
			(property === 'qnum'  || 
			 property === 'qnum2' ||
			 property === 'qchar' ||
			 property === 'anum'  ||
			(property === 'snum' && lastope.pos === this.pos))
		)
		{
			lastope.num = this.num;
			return true;
		}
		return false;
	}
519310
def spell_three_digits(num, power)
      answer = []
      yekan = nil
      num.each_with_index do |n, i|
        # The 'n' is zero? no need to evaluate
        next if n == '0'
        exception_index = n.to_i * (10**i)

        case i
        when 0
          # save Yekan to use for 10..19 exceptions
          yekan = n
        when 1
          # If we're in Sadgan and the digit is 1 so it's a number
          # between 10..19 and it's an exception
          if n == '1'
            exception_index = 10 + yekan.to_i
            answer.clear
          end
        end
        answer << EXCEPTIONS_INVERT[exception_index]
      end
      # append power of ten to first number based on `power` passed to function
      # 
      answer[0] = "#{answer[0]} #{(POWER_OF_TEN_INVERT[power])}".strip if answer.size > 0
      answer
    end
267619
public static IsLessThan isLessThan(ComparableExpression<Number> left, ComparableExpression<Number> right) {
        return new IsLessThan(left, right);
    }
1324230
protected void init() {
        
        if(isZero()) {
            this.integerPart = "";
            this.decimalPart = "";
            return;
        }
        
        final StringBuilder sb = new StringBuilder();
        sb.append("#");
        if(scale > 0) {
            sb.append(".");
        }
        
        // 小数の精度分、書式を追加する。
        for(int i=0; i < scale; i++) {
            sb.append("#");
        }
        
        final DecimalFormat format = new DecimalFormat(sb.toString());
        format.setRoundingMode(RoundingMode.HALF_UP);
        
        double num = Math.abs(getValue());
        if(getPermilles() > 0) {
            num /= Math.pow(1000, getPermilles());
        }
        
        String str = format.format(num);
        
        // 数値を小数部と整数部に分割する。
        setupIntegerAndDecimalPart(str);
        
    }
225081
function moneySmalltoBig(n) {
    if (!_.isNumber(n) || _.isNaN(n))
        return ''

    var fraction = ['角', '分'];
    var digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
    var unit = [['元', '万', '亿'], ['', '拾', '佰', '仟']];
    var head = n < 0 ? '欠' : '';
    n = Math.abs(n);

    var s = '';

    for (var i = 0; i < fraction.length; i++) {
        s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
    }
    s = s || '整';
    n = Math.floor(n);

    for (var i = 0; i < unit[0].length && n > 0; i++) {
        var p = '';
        for (var j = 0; j < unit[1].length && n > 0; j++) {
            p = digit[n % 10] + unit[1][j] + p;
            n = Math.floor(n / 10);
        }
        s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
    }
    return head + s.replace(/(零.)*零元/, '元').replace(/(零.)+/g, '零').replace(/^整$/, '零元整');
}
1015238
private void setSentenceSpan(JSONObject cNode, JSONObject parent) {
    try {
      JSONObject data = cNode.getJSONObject("data");

      int leftPosC = data.getInt(SENTENCE_LEFT);
      int rightPosC = data.getInt(SENTENCE_RIGHT);

      data = parent.getJSONObject("data");

      if (data.has(SENTENCE_LEFT)) {
        data.put(SENTENCE_LEFT, Math.min(leftPosC, data.getInt(SENTENCE_LEFT)));
      } else {
        data.put(SENTENCE_LEFT, leftPosC);
      }

      if (data.has(SENTENCE_RIGHT)) {
        data.put(SENTENCE_RIGHT,
                Math.max(rightPosC, data.getInt(SENTENCE_RIGHT)));
      } else {
        data.put(SENTENCE_RIGHT, rightPosC);
      }
    } catch (JSONException ex) {
      log.debug("error while setting left and right position for sentences", ex);
    }
  }
73994
function(num) {
		var v = new Number(num);
		if (v) {
			if (v.toLocaleString) {
				return v.toLocaleString();
			} else {
				return String(num).replace( /(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
			}
		}
		return num;
	}
812644
function onWhichEvent(sense, name, nbFinger) {
        var prefix = 'Short';
        if (sense.hasPaused) prefix = 'Long';
        var onEventName = 'on' + prefix + name + nbFinger;
        if (a4p.isDefined(sense[onEventName]) && (sense[onEventName] != null)) {
            return onEventName;
        }
        if (sense.options.prefixPriority) {
            // the 'Short'/'Long' prefix has priority over the number of fingers  : sense-long-tap before sense-tap-2
            onEventName = 'on' + prefix + name;
            if (a4p.isDefined(sense[onEventName]) && (sense[onEventName] != null)) {
                return onEventName;
            }
            onEventName = 'on' + name + nbFinger;
            if (a4p.isDefined(sense[onEventName]) && (sense[onEventName] != null)) {
                return onEventName;
            }
        } else {
            // the number of fingers has priority over the 'Short'/'Long' prefix  : sense-tap-2 before sense-long-tap
            onEventName = 'on' + name + nbFinger;
            if (a4p.isDefined(sense[onEventName]) && (sense[onEventName] != null)) {
                return onEventName;
            }
            onEventName = 'on' + prefix + name;
            if (a4p.isDefined(sense[onEventName]) && (sense[onEventName] != null)) {
                return onEventName;
            }
        }
        onEventName = 'on' + name;
        if (a4p.isDefined(sense[onEventName]) && (sense[onEventName] != null)) {
            return onEventName;
        }
        return '';
    }
1075225
function(body, r, n)
{
    var rcn = vcross(r, n);
    return body.m_inv + body.i_inv*rcn*rcn;
}
1332588
def numToDigits(num, places):
    
    s = str(num)
    if len(s) < places:
        return ("0" * (places - len(s))) + s
    elif len(s) > places:
        return s[len(s)-places: ]
    else:
        return s
400574
public static function num2rmb($number = 0, $int_unit = '元', $is_round = true, $is_extra_zero = false)
    {
        // 将数字切分成两段
        $parts = explode('.', $number, 2);
        $int = isset($parts[0]) ? strval($parts[0]) : '0';
        $dec = isset($parts[1]) ? strval($parts[1]) : '';

        // 如果小数点后多于2位，不四舍五入就直接截，否则就处理
        $dec_len = strlen($dec);
        if (isset($parts[1]) && $dec_len > 2) {
            $dec = $is_round
                ? substr(strrchr(strval(round(floatval("0.".$dec), 2)), '.'), 1)
                : substr($parts[1], 0, 2);
        }

        // 当number为0.001时，小数点后的金额为0元
        if (empty($int) && empty($dec)) {
            return '零';
        }

        // 定义
        $chs = array('0','壹','贰','叁','肆','伍','陆','柒','捌','玖');
        $uni = array('','拾','佰','仟');
        $dec_uni = array('角', '分');
        $exp = array('', '万');
        $res = '';

        // 整数部分从右向左找
        for ($i = strlen($int) - 1, $k = 0; $i >= 0; $k++) {
            $str = '';
            // 按照中文读写习惯，每4个字为一段进行转化，i一直在减
            for ($j = 0; $j < 4 && $i >= 0; $j++, $i--) {
                $u = $int{$i} > 0 ? $uni[$j] : ''; // 非0的数字后面添加单位
                $str = $chs[$int{$i}] . $u . $str;
            }
            //echo $str."|".($k - 2)."<br>";
            $str = rtrim($str, '0');// 去掉末尾的0
            $str = preg_replace("/0+/", "零", $str); // 替换多个连续的0
            if (!isset($exp[$k])) {
                $exp[$k] = $exp[$k - 2] . '亿'; // 构建单位
            }
            $u2 = $str != '' ? $exp[$k] : '';
            $res = $str . $u2 . $res;
        }

        // 如果小数部分处理完之后是00，需要处理下
        $dec = rtrim($dec, '0');

        // 小数部分从左向右找
        if (!empty($dec)) {
            $res .= $int_unit;

            // 是否要在整数部分以0结尾的数字后附加0，有的系统有这要求
            if ($is_extra_zero) {
                if (substr($int, -1) === '0') {
                    $res.= '零';
                }
            }

            for ($i = 0, $cnt = strlen($dec); $i < $cnt; $i++) {
                $u = $dec{$i} > 0 ? $dec_uni[$i] : ''; // 非0的数字后面添加单位
                $res .= $chs[$dec{$i}] . $u;
            }
            $res = rtrim($res, '0');// 去掉末尾的0
            $res = preg_replace("/0+/", "零", $res); // 替换多个连续的0
        } else {
            $res .= $int_unit . '整';
        }
        return $res;
    }
36813
void robotMove(int nx, int ny)
    {
        oldX = x;
        oldY = y;
        x = nx;
        y = ny;
        wx = nx;
        wy = ny;
        mx = x - oldX;
        my = y - oldY;
        moved = true;
    }