mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			20 lines
		
	
	
		
			435 B
		
	
	
	
		
			Solidity
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			435 B
		
	
	
	
		
			Solidity
		
	
	
	
	
	
| library D { function length(string memory self) public returns (uint) { return bytes(self).length; } }
 | |
| contract C {
 | |
|     using D for string;
 | |
|     string x;
 | |
|     function f() public returns (uint) {
 | |
|         x = "abc";
 | |
|         return x.length();
 | |
|     }
 | |
|     function g() public returns (uint) {
 | |
|         string memory s = "abc";
 | |
|         return s.length();
 | |
|     }
 | |
| }
 | |
| // ====
 | |
| // compileToEwasm: false
 | |
| // ----
 | |
| // library: D
 | |
| // f() -> 3
 | |
| // g() -> 3
 |