Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String getAddressFromBip21String(String addressString) {
        int bitcoinUriIndex = addressString.indexOf(":");
        int paramsIndex = addressString.indexOf("?");

        if (bitcoinUriIndex != -1) {
            // get address from bitcoin uri scheme
            if (paramsIndex != -1)
                return addressString.substring(bitcoinUriIndex + 1, paramsIndex);
            else
                return addressString.substring(bitcoinUriIndex + 1);
        } else {
            // not using BIP 21
            return addressString;
        }
    }
}